@@ -223,21 +223,23 @@ def test_reconstruct_patches_perfect_color(orange_face):
223
223
np .testing .assert_array_almost_equal (face , face_reconstructed )
224
224
225
225
226
- def test_patch_extractor_fit (downsampled_face_collection ):
226
+ def test_patch_extractor_fit (downsampled_face_collection , global_random_seed ):
227
227
faces = downsampled_face_collection
228
- extr = PatchExtractor (patch_size = (8 , 8 ), max_patches = 100 , random_state = 0 )
228
+ extr = PatchExtractor (
229
+ patch_size = (8 , 8 ), max_patches = 100 , random_state = global_random_seed
230
+ )
229
231
assert extr == extr .fit (faces )
230
232
231
233
232
- def test_patch_extractor_max_patches (downsampled_face_collection ):
234
+ def test_patch_extractor_max_patches (downsampled_face_collection , global_random_seed ):
233
235
faces = downsampled_face_collection
234
236
i_h , i_w = faces .shape [1 :3 ]
235
237
p_h , p_w = 8 , 8
236
238
237
239
max_patches = 100
238
240
expected_n_patches = len (faces ) * max_patches
239
241
extr = PatchExtractor (
240
- patch_size = (p_h , p_w ), max_patches = max_patches , random_state = 0
242
+ patch_size = (p_h , p_w ), max_patches = max_patches , random_state = global_random_seed
241
243
)
242
244
patches = extr .transform (faces )
243
245
assert patches .shape == (expected_n_patches , p_h , p_w )
@@ -247,35 +249,37 @@ def test_patch_extractor_max_patches(downsampled_face_collection):
247
249
(i_h - p_h + 1 ) * (i_w - p_w + 1 ) * max_patches
248
250
)
249
251
extr = PatchExtractor (
250
- patch_size = (p_h , p_w ), max_patches = max_patches , random_state = 0
252
+ patch_size = (p_h , p_w ), max_patches = max_patches , random_state = global_random_seed
251
253
)
252
254
patches = extr .transform (faces )
253
255
assert patches .shape == (expected_n_patches , p_h , p_w )
254
256
255
257
256
- def test_patch_extractor_max_patches_default (downsampled_face_collection ):
258
+ def test_patch_extractor_max_patches_default (
259
+ downsampled_face_collection , global_random_seed
260
+ ):
257
261
faces = downsampled_face_collection
258
- extr = PatchExtractor (max_patches = 100 , random_state = 0 )
262
+ extr = PatchExtractor (max_patches = 100 , random_state = global_random_seed )
259
263
patches = extr .transform (faces )
260
264
assert patches .shape == (len (faces ) * 100 , 19 , 25 )
261
265
262
266
263
- def test_patch_extractor_all_patches (downsampled_face_collection ):
267
+ def test_patch_extractor_all_patches (downsampled_face_collection , global_random_seed ):
264
268
faces = downsampled_face_collection
265
269
i_h , i_w = faces .shape [1 :3 ]
266
270
p_h , p_w = 8 , 8
267
271
expected_n_patches = len (faces ) * (i_h - p_h + 1 ) * (i_w - p_w + 1 )
268
- extr = PatchExtractor (patch_size = (p_h , p_w ), random_state = 0 )
272
+ extr = PatchExtractor (patch_size = (p_h , p_w ), random_state = global_random_seed )
269
273
patches = extr .transform (faces )
270
274
assert patches .shape == (expected_n_patches , p_h , p_w )
271
275
272
276
273
- def test_patch_extractor_color (orange_face ):
277
+ def test_patch_extractor_color (orange_face , global_random_seed ):
274
278
faces = _make_images (orange_face )
275
279
i_h , i_w = faces .shape [1 :3 ]
276
280
p_h , p_w = 8 , 8
277
281
expected_n_patches = len (faces ) * (i_h - p_h + 1 ) * (i_w - p_w + 1 )
278
- extr = PatchExtractor (patch_size = (p_h , p_w ), random_state = 0 )
282
+ extr = PatchExtractor (patch_size = (p_h , p_w ), random_state = global_random_seed )
279
283
patches = extr .transform (faces )
280
284
assert patches .shape == (expected_n_patches , p_h , p_w , 3 )
281
285
0 commit comments