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: string indices must be integers #55

Open
potSm0ker opened this issue Aug 21, 2023 · 5 comments
Open

TypeError: string indices must be integers #55

potSm0ker opened this issue Aug 21, 2023 · 5 comments

Comments

@potSm0ker
Copy link

Trying to run script labelbox_Json2yolo.py.
I am getting error line 22, in convert
im_path = img['Labeled Data']
TypeError: string indices must be integers

It creates a directory with the name of my json file and two sub directories - images and labels. Then i get the error.
all i did was change the bottom line to the path of my json file.

@potSm0ker
Copy link
Author

these scripts dont work, ive been trying for hours.

@HawkingRadiation42
Copy link

so how have you solved your problem?
i want to convert my coco.json file to yolov8 format for segmentation.

@glenn-jocher
Copy link
Member

I understand your frustration, and I'm here to help. To address the "string indices must be integers" error, this typically occurs when trying to access a dictionary key using a string when the value is expected to be an integer. In the provided error, it seems that you are attempting to access a key in a dictionary using a string, but the key actually requires an integer index. You'll need to review the specific code at line 22 and ensure that you are accessing the dictionary correctly.

Regarding your requirement to convert a COCO JSON file to YOLOv8 format for segmentation, the Ultralytics YOLO repositories offer tools like coco2yolo.py which can be used for this purpose. However, it's worth noting that direct segmentation support in YOLOv8 is currently under development in the latest YOLOv5. If you're looking for segmentation capabilities, I would recommend exploring YOLOv5 or other segmentation-specific tools.

Feel free to ask for further clarification or assistance with any specific issues you encounter during this process.

@freds-dev
Copy link

any updates on this?

@glenn-jocher
Copy link
Member

@freds-dev i can understand your frustration, and I assure you I am committed to helping you resolve the issue. To address the "string indices must be integers" error you encountered, please ensure that you are accessing the dictionary correctly at the specific line mentioned in the error. If you need further assistance with this, please provide more details about the code segment causing the error, and I will be glad to offer additional guidance.

Regarding the COCO JSON to YOLOv8 format conversion for segmentation, as of now, direct segmentation support is under active development in the latest YOLOv5. While YOLOv8 is an advancement of YOLOv5, I recommend exploring YOLOv5 or other specialized tools for your segmentation requirements. If you'd like further assistance with any specific aspect of this process, feel free to ask, and I'd be happy to help.

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

4 participants