Add ratio_of_unchanged_images
This commit is contained in:
parent
bf524eea0b
commit
c7c0f292c6
1 changed files with 5 additions and 0 deletions
|
|
@ -14,6 +14,11 @@ import numpy as np
|
||||||
|
|
||||||
def random_edit(img: Image, seed: int = 42) -> Image:
|
def random_edit(img: Image, seed: int = 42) -> Image:
|
||||||
np.random.seed(seed)
|
np.random.seed(seed)
|
||||||
|
|
||||||
|
ratio_of_unchanged_images = 0.95
|
||||||
|
if np.random.uniform(0, 1) > ratio_of_unchanged_images:
|
||||||
|
return img
|
||||||
|
|
||||||
img = img.convert("RGB")
|
img = img.convert("RGB")
|
||||||
|
|
||||||
img = ImageEnhance.Contrast(img).enhance(random(0.5, 1.5))
|
img = ImageEnhance.Contrast(img).enhance(random(0.5, 1.5))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue