From 3ec41555c737f74c88ceecb9811093ad091649b6 Mon Sep 17 00:00:00 2001 From: Himanshu Mishra Date: Sun, 24 Jan 2016 15:16:46 +0530 Subject: [PATCH] Modify tests for hog after renaming kwarg normalise --- skimage/feature/tests/test_hog.py | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/skimage/feature/tests/test_hog.py b/skimage/feature/tests/test_hog.py index 852dbff5..7607386c 100644 --- a/skimage/feature/tests/test_hog.py +++ b/skimage/feature/tests/test_hog.py @@ -24,11 +24,11 @@ def test_histogram_of_oriented_gradients_output_size(): def test_histogram_of_oriented_gradients_output_correctness(): img = color.rgb2gray(data.astronaut()) correct_output = np.load(os.path.join(si.data_dir, 'astronaut_GRAY_hog.npy')) - - output = feature.hog(img, orientations=9, pixels_per_cell=(8, 8), + + output = feature.hog(img, orientations=9, pixels_per_cell=(8, 8), cells_per_block=(3, 3), feature_vector=True, - normalise=False, visualise=False) - + transform_sqrt=False, visualise=False) + assert_almost_equal(output, correct_output) @@ -49,7 +49,7 @@ def test_hog_basic_orientations_and_data_types(): # 1) create image (with float values) where upper half is filled by # zeros, bottom half by 100 # 2) create unsigned integer version of this image - # 3) calculate feature.hog() for both images, both with 'normalise' + # 3) calculate feature.hog() for both images, both with 'transform_sqrt' # option enabled and disabled # 4) verify that all results are equal where expected # 5) verify that computed feature vector is as expected @@ -70,16 +70,16 @@ def test_hog_basic_orientations_and_data_types(): (hog_float, hog_img_float) = feature.hog( image_float, orientations=4, pixels_per_cell=(8, 8), - cells_per_block=(1, 1), visualise=True, normalise=False) + cells_per_block=(1, 1), visualise=True, transform_sqrt=False) (hog_uint8, hog_img_uint8) = feature.hog( image_uint8, orientations=4, pixels_per_cell=(8, 8), - cells_per_block=(1, 1), visualise=True, normalise=False) + cells_per_block=(1, 1), visualise=True, transform_sqrt=False) (hog_float_norm, hog_img_float_norm) = feature.hog( image_float, orientations=4, pixels_per_cell=(8, 8), - cells_per_block=(1, 1), visualise=True, normalise=True) + cells_per_block=(1, 1), visualise=True, transform_sqrt=True) (hog_uint8_norm, hog_img_uint8_norm) = feature.hog( image_uint8, orientations=4, pixels_per_cell=(8, 8), - cells_per_block=(1, 1), visualise=True, normalise=True) + cells_per_block=(1, 1), visualise=True, transform_sqrt=True) # set to True to enable manual debugging with graphical output, # must be False for automatic testing @@ -101,11 +101,11 @@ def test_hog_basic_orientations_and_data_types(): plt.subplot(2, 3, 3) plt.imshow(hog_img_float_norm) plt.colorbar() - plt.title('HOG result (normalise) visualisation (float img)') + plt.title('HOG result (transform_sqrt) visualisation (float img)') plt.subplot(2, 3, 6) plt.imshow(hog_img_uint8_norm) plt.colorbar() - plt.title('HOG result (normalise) visualisation (uint8 img)') + plt.title('HOG result (transform_sqrt) visualisation (uint8 img)') plt.show() # results (features and visualisation) for float and uint8 images must @@ -113,7 +113,7 @@ def test_hog_basic_orientations_and_data_types(): assert_almost_equal(hog_float, hog_uint8) assert_almost_equal(hog_img_float, hog_img_uint8) - # resulting features should be almost equal when 'normalise' is enabled + # resulting features should be almost equal when 'transform_sqrt' is enabled # or disabled (for current simple testing image) assert_almost_equal(hog_float, hog_float_norm, decimal=4) assert_almost_equal(hog_float, hog_uint8_norm, decimal=4) @@ -157,7 +157,7 @@ def test_hog_orientations_circle(): (hog, hog_img) = feature.hog(image, orientations=orientations, pixels_per_cell=(8, 8), cells_per_block=(1, 1), visualise=True, - normalise=False) + transform_sqrt=False) # set to True to enable manual debugging with graphical output, # must be False for automatic testing