Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling status on a pipeline without labels results in error #156

Closed
maartenterpstra opened this issue Jan 9, 2019 · 3 comments
Closed
Labels

Comments

@maartenterpstra
Copy link

Hi, I try to use this library for transforming my first set of images with a known ground truth. These have no labels, I just want transformed images for use with my network. Therefore, I try to follow the DataPipeline example as follows:

>> import glob
>> import numpy
>> from PIL import Image
>> import Augmentor
>> ref_imgs = glob.glob('./reference_images/**/*.jpg')
>> imgs = glob.glob('./images/**/*.jpg')
>> collated = list(zip(ref_imgs, imgs))
>> len(collated)
130475
>> images = [[np.asarray(Image.open(y)) for y in x] for x in collated]
>> p = Augmentor.DataPipeline(images)
>> p.rotate(1, max_left_rotation=5, max_right_rotation=5)
>> p.flip_top_bottom(0.5)
>> p.zoom_random(1, percentage_area=0.5)
>> p.status()
Operations: 3
	0: RotateRange (probability=1 max_left_rotation=-5 max_right_rotation=5 )
	1: Flip (probability=0.5 top_bottom_left_right=TOP_BOTTOM )
	2: ZoomRandom (probability=1 percentage_area=0.5 randomise=False )
Images: 130475
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/local_scratch2/mterpst5/anaconda3/lib/python3.7/site-packages/Augmentor/Pipeline.py", line 798, in status
    label_pairs = sorted(set([x.label_pair for x in self.augmentor_images]))
  File "/local_scratch2/mterpst5/anaconda3/lib/python3.7/site-packages/Augmentor/Pipeline.py", line 798, in <listcomp>
    label_pairs = sorted(set([x.label_pair for x in self.augmentor_images]))
AttributeError: 'list' object has no attribute 'label_pair'

This should not happen because my data has no labels. I suppose a check should be in place to make sure labels are present.

Thanks

@Charles-Lu
Copy link

I reproduce the same bug. For now you can comment out p.status() to avoid the error. The remaining of the pipeline works perfectly.
P.S. also remember to use

augmented_images = p.sample(10)

rather than

augmented_images, labels = p.sample(10)

in following steps.

@mdbloice mdbloice added the bug label Mar 7, 2019
@mdbloice
Copy link
Owner

mdbloice commented Mar 7, 2019

Hi @mlterpstra-umc, @Charles-Lu this is definitely a bug with the status() function, thanks to both of you for rooting it out, I will fix ASAP.

@mdbloice
Copy link
Owner

mdbloice commented Mar 7, 2019

Ok so I have made a quick bug fix, this fix won't appear in the pip installed version of Augmentor until I make a version update which will happen a little later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants