Open makcedward opened 5 years ago
That is not yet possible. It will probably be added at some point in the future, but not clear yet how exactly.
Though for the special case of Affine you can achieve that currently with something like the following:
import imgaug as ia
from imgaug import augmenters as iaa
seed = 1
aug = iaa.Affine(rotate=(0, 359), random_state=seed)
scale_samples, translate_samples, rotate_samples, shear_samples, cval_samples, mode_samples, order_samples = aug._draw_samples(nb_samples=1, random_state=ia.copy_random_state(aug.random_state))
images_aug = aug.augment_images(...)
won't work for most other augmenters though.
@aleju I've got similar problem with filplr Initially I thought it would be easy (just like in bounding_box transformation)
seq_det = seq.to_deterministic()
for i in range(10):
print(seq_det.p.draw_sample()) # should print constant value
But I don't understand why this doesn't work (draw_sample() doesn't return constant value)
Just tried copying random_state and this works even wihout .to_deterministic()
for i in range(10):
print(seq.p.draw_sample(ia.copy_random_state(seq.random_state))) # always constant
Upvoted, this would be extremely helpful. I am building occluders and want to perform some of the same operations on my images and the occluders that I am copying into the background images In particular brighness changes with iaa.Add
this is a useful augmenter, but I don't want the occluder and bg to end up extremely different brightness levels I'd like to save it and apply it to both images. I suppose I can just save Add for last -- put the occluder in, and then apply it to the entire image with bg and occluder.
Not exactly sure what you mean. If you want to apply two different augmentation pipelines -- with both of them containing Add
-- to image inputs and aim to sample the same values for both Adds, then there is a whole notebook on that topic, see Copying Random States and Using Multiple Augmentation Sequences. The quick summary would be to simply use the same seed for both Add
s, e.g. pipeline1 = iaa.Sequential([..., iaa.Add((-50, 50), random_state=1234), ...]); pipeline2 = iaa.Sequential([..., iaa.Add((-50, 50), random_state=1234), ...])
.
Not sure how I missed that but thanks that is exactly what I need!
Thank you very much for this amazing library. It helps on generating lots of data for model training.
Is it possible to get back the applied value if a range of value is passed? For example,
seq = iaa.Sequential([ iaa.Affine( rotate=(0, 359) ) ])
Finally, the image is rotated 45 degree. Can I get back the rotated value which is 45?