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

## local variable 'attempt' referenced before assignment #5

Open
anish9 opened this issue Aug 22, 2018 · 5 comments
Open

## local variable 'attempt' referenced before assignment #5

anish9 opened this issue Aug 22, 2018 · 5 comments

Comments

@anish9
Copy link

anish9 commented Aug 22, 2018

dataset_generator.py", line 514, in <module>
    generate_synthetic_dataset(args)
  File "dataset_generator.py", line 486, in generate_synthetic_dataset
    syn_img_files, anno_files = gen_syn_data(img_files, labels, img_dir, anno_dir, args.scale, args.rotation, args.dontocclude, args.add_distractors)
  File "dataset_generator.py", line 450, in gen_syn_data
    p.map(partial_func, params_list)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 253, in map
    return self.map_async(func, iterable, chunksize).get()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 572, in get
    raise self._value
UnboundLocalError: local variable 'attempt' referenced before assignment
@swanilee
Copy link

Can you fix it? I also find same error.. but i don't know exactly what i do.
If you solve that problem, can teach me how to fix it? Thank you so much!!

@debidatta
Copy link
Owner

There was another issue where someone pointed out this is happening on Windows but not on Linux machines. Are you using Windows for this?

@MC-devel-staudt
Copy link

I solved this by changing the signature of create_image_anno from,

def create_image_anno(objects, distractor_objects, img_file, anno_file, bg_file, w=WIDTH, h=HEIGHT, scale_augment=False, rotation_augment=False, blending_list=['none'], dontocclude=False):

to

def create_image_anno(objects, distractor_objects, img_file, anno_file, bg_file, w=WIDTH, h=HEIGHT, scale_augment=False, rotation_augment=False, blending_list=['none'], dontocclude=False, attempt=0):

It defines attempt before the function is called. I'm not sure why this works though.

@Adi11cr7
Copy link

@MC-devel-staudt after I doing this the objects are not being pasted on the background

@Adi11cr7
Copy link

Apparently all the object images need to be of the same size

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

No branches or pull requests

5 participants