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

requiremets.txt might help with potential user issues #11

Open
anhelina007 opened this issue Apr 29, 2024 · 4 comments
Open

requiremets.txt might help with potential user issues #11

anhelina007 opened this issue Apr 29, 2024 · 4 comments

Comments

@anhelina007
Copy link

anhelina007 commented Apr 29, 2024

Hi! I just started using you amazing tool for a university robotics project.

We as a team have already spend numerous days on trying to figure out the error the constantly get with any kind of json we are using

    return _mask.decode(rleObjs)
  File "pycocotools/_mask.pyx", line 145, in pycocotools._mask.decode
  File "pycocotools/_mask.pyx", line 127, in pycocotools._mask._frString
TypeError: list indices must be integers or slices, not str

which happens in the following line of code:

masks = [maskUtils.decode(ann['segmentation']) for ann in dataset_dict['annotations']].

We have also tried CanaTree100 dataset that you provided.

I would really appreciate your help since we want to upgrade your work and train it on jungle data.

@pie-leroy
Copy link

pie-leroy commented May 7, 2024

Hello,

I had a similar error some time ago, installing detectron2 leads to many errors that are related to version incompatibilities between several libraries.

To save time I created a notebook on google collab that allows to run everything (check the use of gpu in google collab).

If you have any questions, don't hesitate!

https://colab.research.google.com/drive/1lRF7GhxwFwVgJBtBLy5TYLXD_vnRDHDv?usp=sharing

@anhelina007
Copy link
Author

Thank you a lot! Could you please make it public?

@pie-leroy
Copy link

@VGrondin
Copy link
Collaborator

Hi! I just started using you amazing tool for a university robotics project.

We as a team have already spend numerous days on trying to figure out the error the constantly get with any kind of json we are using

    return _mask.decode(rleObjs)
  File "pycocotools/_mask.pyx", line 145, in pycocotools._mask.decode
  File "pycocotools/_mask.pyx", line 127, in pycocotools._mask._frString
TypeError: list indices must be integers or slices, not str

which happens in the following line of code:

masks = [maskUtils.decode(ann['segmentation']) for ann in dataset_dict['annotations']].

We have also tried CanaTree100 dataset that you provided.

I would really appreciate your help since we want to upgrade your work and train it on jungle data.

Hi, I remember getting this error a few times when switching between the synthetic/real dataset. IIRC this issue is caused by the segmentation mask encoding method. Depending on which encoding (RLE or bitmask) was used for the segmentation mask annotations, this error arises. In your case, it would seem that your annotations are already in RLE format since the
return _mask.decode(rleObjs) is an error.
masks = [maskUtils.decode(ann['segmentation']) for ann in dataset_dict['annotations']]
This is because the maskUtils.decode function decodes a binary mask into a RLE format (https://github.com/cocodataset/cocoapi/blob/master/PythonAPI/pycocotools/mask.py), but your input is already in RLE format. You might be able to simply replace it with
masks = [ann['segmentation'] for ann in dataset_dict['annotations']]

Hope it helps!

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

3 participants