mirror of
https://github.com/iperov/DeepFaceLab.git
synced 2025-07-05 20:42:11 -07:00
SampleGeneratorFaceXSeg: additional sample augmentation for better generalization
This commit is contained in:
parent
8b90ca0dac
commit
65a703c024
1 changed files with 11 additions and 5 deletions
|
@ -152,17 +152,23 @@ class SampleGeneratorFaceXSeg(SampleGeneratorBase):
|
|||
mask[mask >= 0.5] = 1.0
|
||||
mask = np.clip(mask, 0, 1)
|
||||
|
||||
if np.random.randint(2) == 0:
|
||||
img = imagelib.apply_random_hsv_shift(img, mask=sd.random_circle_faded ([resolution,resolution]))
|
||||
else:
|
||||
img = imagelib.apply_random_rgb_levels(img, mask=sd.random_circle_faded ([resolution,resolution]))
|
||||
|
||||
if np.random.randint(2) == 0:
|
||||
# random face flare
|
||||
krn = np.random.randint( resolution//4, resolution )
|
||||
krn = krn - krn % 2 + 1
|
||||
img = img + cv2.GaussianBlur(img*mask, (krn,krn), 0)
|
||||
|
||||
if np.random.randint(2) == 0:
|
||||
# random bg flare
|
||||
krn = np.random.randint( resolution//4, resolution )
|
||||
krn = krn - krn % 2 + 1
|
||||
img = img + cv2.GaussianBlur(img*(1-mask), (krn,krn), 0)
|
||||
|
||||
if np.random.randint(2) == 0:
|
||||
img = imagelib.apply_random_hsv_shift(img, mask=sd.random_circle_faded ([resolution,resolution]))
|
||||
else:
|
||||
img = imagelib.apply_random_rgb_levels(img, mask=sd.random_circle_faded ([resolution,resolution]))
|
||||
|
||||
if np.random.randint(2) == 0:
|
||||
img = imagelib.apply_random_sharpen( img, sharpen_chance, sharpen_kernel_max_size, mask=sd.random_circle_faded ([resolution,resolution]))
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue