mdbloice / Augmentor

Image augmentation library in Python for machine learning.
https://augmentor.readthedocs.io/en/stable
MIT License
5.08k stars 866 forks source link

sample with array fails #224

Open nyk2001 opened 4 years ago

nyk2001 commented 4 years ago

Hi,

I am using Augmentor package 0.2.8 (with Anaconda)

I am using an image to generate sample data but I am getting an error message. My code is


img_array = np.asarray(PIL.Image.open(r"A.png"))
p = Augmentor.Pipeline()
p.flip_top_bottom(0.5)
img_augmented = p.sample_with_array(img_array)

I get the following error message


 return images[0]
IndexError: list index out of range

Can anyone please help me with that ?

zabboud commented 2 years ago

I'm not sure if this is relevant anymore -- but here's the answer in case anyone else might need it.

You want to use Augmentor.DataPipeline() instead of Augmentor.Pipeline() when feeding in arrays.

It takes in two arguments, the first one is a list of lists of arrays, the second one is a list of labels. Check out the example in the link.