Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Deterministic order for load_sample_images #13250

Merged
merged 13 commits into from Feb 26, 2019
Copy path View file
@@ -794,7 +794,7 @@ def load_sample_images():
with open(join(module_path, 'README.txt')) as f:
descr = f.read()
filenames = [join(module_path, filename)
for filename in os.listdir(module_path)
for filename in sorted(os.listdir(module_path))
if filename.endswith(".jpg")]
# Load image data for each image in the source folder.
images = [imread(filename) for filename in filenames]
@@ -347,6 +347,17 @@ def extract_patches_2d(image, patch_size, max_patches=None, random_state=None):
>>> patches = image.extract_patches_2d(one_image, (2, 2))
>>> print('Patches shape: {}'.format(patches.shape))
Patches shape: (272214, 2, 2, 3)
>>> # Here are just two of these patches:
>>> print(patches[1]) # doctest: +NORMALIZE_WHITESPACE
[[[174 201 231]
[174 201 231]]
[[173 200 230]
[173 200 230]]]
>>> print(patches[800])# doctest: +NORMALIZE_WHITESPACE
[[[187 214 243]
[188 215 244]]
[[187 214 243]
[188 215 244]]]
"""
i_h, i_w = image.shape[:2]
p_h, p_w = patch_size
@@ -523,6 +534,3 @@ def transform(self, X):
patches[ii * n_patches:(ii + 1) * n_patches] = extract_patches_2d(
image, patch_size, self.max_patches, self.random_state)
return patches

def _more_tags(self):

This comment has been minimized.

Copy link
@qinhanmin2014
return {'X_types': ['3darray']}
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.