JSON2YOLO icon indicating copy to clipboard operation
JSON2YOLO copied to clipboard

An output directory should be added

Open monkeycc opened this issue 3 years ago • 2 comments

An output directory should be added

monkeycc avatar Sep 03 '22 09:09 monkeycc

Thanks for writing the issue. We check it works using this script global_json2yolo.py.

Looking at the global_json2yolo code, there are some flags. Converting the COCO bbox format to YOLO bbox format.

use_segments=False,
use_keypoints=False,

Converting the COCO segmentation format to YOLO segmentation format.

use_segments=True,
use_keypoints=False,

Converting the COCO keypoints format to YOLO keypoints format.

use_segments=False,
use_keypoints=True,

To convert the COCO segmentation format to YOLO segmentation format.

if __name__ == '__main__':
    source = 'COCO'

    if source == 'COCO':
        convert_coco_json('../datasets/coco/annotations',  # directory with *.json
                          use_segments=True,
                          use_keypoints=False,
                          cls91to80=False)

This is the folder structure when we run the script.

スクリーンショット 2023-10-25 20 51 05

Please let us know your opinion.

ryouchinsa avatar Oct 25 '23 13:10 ryouchinsa

Thank you for sharing your insights and the use of the global_json2yolo.py script. It's great to see the different flags and options for converting COCO format to YOLO format.

Regarding your request for an output directory, it seems that the script currently does not have an explicit option to specify an output directory. If you need to save the converted YOLO files to a specific directory, you can modify the script to include this functionality. You can achieve this by adding a parameter to the convert_coco_json function to specify the output directory, then adjust the code to save the YOLO files to that directory.

Feel free to let me know if you need further assistance or guidance on how to implement this. We're always here to help.

glenn-jocher avatar Nov 09 '23 18:11 glenn-jocher