where is the convert.py??
Hello! The converter.py file is part of the main ultralytics package. You can find the source code directly on GitHub within the ultralytics/data/converter.py file.
python.exe .\converter.py --json_dir E:\Pycharm_cache\datasets\攀爬\coco\person_keypoints_val2017.json --save_dir E:\Pycharm_cache\datasets\攀爬\coco\labels
运行没反应的
Hi @guopeizhao,
It appears you're trying to run the converter.py file directly, but it's not meant to be executed this way. Instead, you should use the Python API by importing the convert_coco function from the ultralytics package.
Here's how to properly convert your COCO annotations to YOLO format:
from ultralytics.data.converter import convert_coco
# For keypoints data (like person_keypoints_val2017.json)
convert_coco(
labels_dir="E:/Pycharm_cache/datasets/攀爬/coco/", # Directory containing your json file
save_dir="E:/Pycharm_cache/datasets/攀爬/coco/labels",
use_keypoints=True # Since you're using keypoints data
)
Run this code as a Python script or in a Python interpreter, not as a direct command line execution of the converter.py file.
The Readme needs to be adjusted. It's not correctly described there.
Hi @Hapyr,
You're absolutely right. The README in this repository needs updating to reflect the current implementation. The JSON2YOLO functionality has been integrated into the main Ultralytics package and improved significantly.
For anyone looking to convert COCO format to YOLO, please use the convert_coco() function from the main package as documented in the Ultralytics data converter reference documentation. The standalone converter scripts in this repository are deprecated.
Thank you for pointing this out - we'll update the README to prevent further confusion.
@Hapyr could you please submit a PR for README updates? Thank you!
Alright, PR #122 should point this out.
Thank you @Hapyr for submitting PR #122! That will help clarify the current state of the conversion tools and direct users to the proper implementation in the main ultralytics package.
I think since PR #122 is merged now, this issue can be closed.
Agreed! With PR #122 merged and the README updated to clarify that the conversion functionality is now in the main ultralytics package, this issue is resolved. Thank you for your contribution @Hapyr!