lundi 18 janvier 2021

How to have an image go through many functions determined by probability weights?

I have a transparent logo. What I am doing now is that I am setting probability weights for all of these functions and the logo goes to only one of them at a time depending on its probability value. This is my code:

augmentation_func = [(random_rotation, [brand_logo]),
                             (blurring, [brand_logo]),
                             (compression, [brand_logo]),
                             (portion_covering, [brand_logo, brand_logo_width, brand_logo_height]),
                             (perspective_transform, [logo_image, brand_logo_width, brand_logo_height]),
                             (overlaying, [logo_path]),
                             (logo_background, [logo_path])]

        (augs, args), = random.choices(augmentation_func, weights=[10,5,15,20,20,15,15])

        new_logo = random_resize(augs(*args), gameplay)

However, this isn't sufficient. The logo should be able to go through multiple functions. Whether it will go through a function or not should depend on its probability weight. This is my idea:

enter image description here

How can I adjust my code so that the logo goes through many transformation functions depending on the weights?




Aucun commentaire:

Enregistrer un commentaire