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

TypeError with curr['id'] #5

Open
aidamanzano opened this issue May 14, 2020 · 0 comments
Open

TypeError with curr['id'] #5

aidamanzano opened this issue May 14, 2020 · 0 comments

Comments

@aidamanzano
Copy link

Hi thank you for your code, this is exactly what I am looking for! I have a COCO formatted file of .json annotations for this dataset and I am trying to generate a .txt file for each image with the same name of the image and the YOLOv3 format. When I run the code with the path to my annotations file I get this error:
Traceback (most recent call last): File "dark_chocolate.py", line 55, in <module> dark_chocolate(opt.input_path) File "dark_chocolate.py", line 47, in dark_chocolate lambda x: ingredients(x, _path)) File "/home/aida/.local/lib/python3.7/site-packages/pydash/collections.py", line 538, in map_ return list(itermap(collection, iteratee)) File "/home/aida/.local/lib/python3.7/site-packages/pydash/collections.py", line 1103, in itermap for result in iteriteratee(collection, iteratee): File "/home/aida/.local/lib/python3.7/site-packages/pydash/helpers.py", line 97, in iteriteratee yield (callit(cbk, item, key, obj, argcount=argcount), File "/home/aida/.local/lib/python3.7/site-packages/pydash/helpers.py", line 38, in callit return iteratee(*args[:argstop]) File "dark_chocolate.py", line 47, in <lambda> lambda x: ingredients(x, _path)) File "dark_chocolate.py", line 28, in ingredients xoxo = _.reduce_right(json.load(f), coco_mixer) File "/home/aida/.local/lib/python3.7/site-packages/pydash/collections.py", line 829, in reduce_right return reduce_(collection, iteratee, accumulator) File "/home/aida/.local/lib/python3.7/site-packages/pydash/collections.py", line 795, in reduce_ result = callit(iteratee, result, item, index, argcount=argcount) File "/home/aida/.local/lib/python3.7/site-packages/pydash/helpers.py", line 38, in callit return iteratee(*args[:argstop]) File "dark_chocolate.py", line 7, in coco_mixer return _.flat_map(acc, lambda xo: { File "/home/aida/.local/lib/python3.7/site-packages/pydash/collections.py", line 264, in flat_map return pyd.flatten(itermap(collection, iteratee=iteratee)) File "/home/aida/.local/lib/python3.7/site-packages/pydash/arrays.py", line 527, in flatten return flatten_depth(array, depth=1) File "/home/aida/.local/lib/python3.7/site-packages/pydash/arrays.py", line 572, in flatten_depth return list(iterflatten(array, depth=depth)) File "/home/aida/.local/lib/python3.7/site-packages/pydash/arrays.py", line 2243, in iterflatten for item in array: File "/home/aida/.local/lib/python3.7/site-packages/pydash/collections.py", line 1103, in itermap for result in iteriteratee(collection, iteratee): File "/home/aida/.local/lib/python3.7/site-packages/pydash/helpers.py", line 97, in iteriteratee yield (callit(cbk, item, key, obj, argcount=argcount), File "/home/aida/.local/lib/python3.7/site-packages/pydash/helpers.py", line 38, in callit return iteratee(*args[:argstop]) File "dark_chocolate.py", line 8, in <lambda> "id": curr['id'], TypeError: list indices must be integers or slices, not str I'm a complete beginner so apologies if this is a very trivial mistake, but I'm not sure what I am doing wrong?

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

1 participant