From 5d5718704d10bcb1b7fa2419e69670096d394811 Mon Sep 17 00:00:00 2001 From: Colombo Date: Wed, 19 Feb 2020 07:00:46 +0400 Subject: [PATCH] fix SampleProcessor --- samplelib/SampleProcessor.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/samplelib/SampleProcessor.py b/samplelib/SampleProcessor.py index b6d78e8..d83cbab 100644 --- a/samplelib/SampleProcessor.py +++ b/samplelib/SampleProcessor.py @@ -194,9 +194,13 @@ class SampleProcessor(object): if gaussian_blur is not None: chance, kernel_max_size = gaussian_blur chance = np.clip(chance, 0, 100) + + rnd_state = np.random.RandomState (sample_rnd_seed+1) + gblur_rnd_chance = rnd_state.randint(100) + gblur_rnd_kernel = rnd_state.randint(kernel_max_size)*2+1 - if np.random.randint(100) < chance: - img = cv2.GaussianBlur(img, ( np.random.randint( kernel_max_size )*2+1 ,) *2 , 0) + if gblur_rnd_chance < chance: + img = cv2.GaussianBlur(img, (gblur_rnd_kernel,) *2 , 0) if is_face_sample: target_ft = SampleProcessor.SPTF_FACETYPE_TO_FACETYPE[target_face_type]