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

How to transfer yolo *.txt (the new segment) to *.json(labelme labeled segment)? #12049

Closed
1 task done
KroitAax opened this issue Aug 29, 2023 · 6 comments
Closed
1 task done
Labels
question Further information is requested Stale

Comments

@KroitAax
Copy link

Search before asking

Question

How to transfer yolo *.txt (the new segment) to *.json(labelme labeled segment)?I hope everyone can give some tips, thank you.

Additional

No response

@KroitAax KroitAax added the question Further information is requested label Aug 29, 2023
@glenn-jocher
Copy link
Member

@KroitAax you can use the "labelme" Python library to convert YOLOv5 .txt annotation files to .json files. Labelme is a popular annotation tool that allows you to label, visualize, and convert annotations.

First, make sure you have the Labelme library installed. You can install it using pip:

pip install labelme

Once installed, you can run the following command to convert your YOLOv5 .txt files to .json:

labelme_convert yolo your_annotation_folder --json_dir converted_json_folder

Replace your_annotation_folder with the folder where your YOLOv5 .txt annotation files are located, and converted_json_folder with the folder where you want to store the converted .json files.

This command will convert each YOLOv5 .txt file into a .json file in the specified output directory.

Please note that the accuracy of the conversion will depend on the consistency and accuracy of the annotations in your YOLO .txt files.

I hope this helps! Let me know if you have any further questions.

@github-actions
Copy link
Contributor

👋 Hello there! We wanted to give you a friendly reminder that this issue has not had any recent activity and may be closed soon, but don't worry - you can always reopen it if needed. If you still have any questions or concerns, please feel free to let us know how we can help.

For additional resources and information, please see the links below:

Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

Thank you for your contributions to YOLO 🚀 and Vision AI ⭐

@github-actions github-actions bot added the Stale label Sep 29, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Oct 9, 2023
@DiogoFerreira77
Copy link

@KroitAax you can use the "labelme" Python library to convert YOLOv5 .txt annotation files to .json files. Labelme is a popular annotation tool that allows you to label, visualize, and convert annotations.

First, make sure you have the Labelme library installed. You can install it using pip:

pip install labelme

Once installed, you can run the following command to convert your YOLOv5 .txt files to .json:

labelme_convert yolo your_annotation_folder --json_dir converted_json_folder

Replace your_annotation_folder with the folder where your YOLOv5 .txt annotation files are located, and converted_json_folder with the folder where you want to store the converted .json files.

This command will convert each YOLOv5 .txt file into a .json file in the specified output directory.

Please note that the accuracy of the conversion will depend on the consistency and accuracy of the annotations in your YOLO .txt files.

I hope this helps! Let me know if you have any further questions.

I did that but it gives me the following error:
labelme_convert : The term 'labelme_convert' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1

  • labelme_convert yolo C:\Users\diogo.ferreira\Desktop\Diogo_part2\labe ...
  •   + CategoryInfo          : ObjectNotFound: (labelme_convert:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException
    
    

I created 2 virtual envs where one I did exactly like you said, and another that I used to install labelme from https://github.com/labelmeai/labelme. Both gave me the same error

@haozi04
Copy link

haozi04 commented Apr 24, 2024

@KroitAax you can use the "labelme" Python library to convert YOLOv5 .txt annotation files to .json files. Labelme is a popular annotation tool that allows you to label, visualize, and convert annotations.

First, make sure you have the Labelme library installed. You can install it using pip:

pip install labelme

Once installed, you can run the following command to convert your YOLOv5 .txt files to .json:

labelme_convert yolo your_annotation_folder --json_dir converted_json_folder

Replace your_annotation_folder with the folder where your YOLOv5 .txt annotation files are located, and converted_json_folder with the folder where you want to store the converted .json files.

This command will convert each YOLOv5 .txt file into a .json file in the specified output directory.

Please note that the accuracy of the conversion will depend on the consistency and accuracy of the annotations in your YOLO .txt files.

I hope this helps! Let me know if you have any further questions.

Sounds like garbage generated from GPTs.

@Abonia1
Copy link

Abonia1 commented May 11, 2024

Hello,
Recently I was searching for similar functionality.I haven't find anything for segmentation task.

So, I have recently released open source, yolosegment2labelme is a library designed to transform YOLO segmentation masks into a format compatible with annotation tools such as LabelMe and Anylabeling, simplifying the annotation process for image segmentation tasks.

pip install yolosegment2labelme

Hope this helps.

@glenn-jocher
Copy link
Member

Hello @Abonia1,

Thanks for sharing your solution with the community! It's great to see such initiatives that help bridge functionalities between different tools. Users looking for converting YOLO segmentation masks to LabelMe compatible formats might find your library very useful. Keep up the good work! 🚀

For everyone else following this thread, please make sure to review the library and test it with sample data to ensure compatibility with your specific requirements. Happy coding!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

5 participants