Add ratio_of_unchanged_images

This commit is contained in:
Andras Schmelczer 2024-06-27 22:26:40 +01:00
parent bf524eea0b
commit c7c0f292c6
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C

View file

@ -14,6 +14,11 @@ import numpy as np
def random_edit(img: Image, seed: int = 42) -> Image:
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 = ImageEnhance.Contrast(img).enhance(random(0.5, 1.5))