Open Aryanjb opened 1 year ago
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.
Please let us know your opinion.
same here. it makes a new directory named "new_dir" and only create the directory structures in it. the problem is in this line: https://github.com/ultralytics/JSON2YOLO/blob/c38a43f342428849c75c103c6d060012a83b5392/general_json2yolo.py#L306
fn
is a PathPosix and so f
. but the problem is that at last the fn
directory is the result of fn / f
.
What about the images directory in the created directory called new_dir
?
There is no code to copy the source images to destination directory!
Thank you for pointing that out. The script currently handles the conversion of annotation files only. To copy the source images to the destination directory, simply use a file copy command to ensure both the image and label files are present in the new_dir
directory.
Hi @SadeghPouriyanZadeh, please copy images by yourself. Do you have any other problems for annotations?
I trien to convert the instances_train2017.json
following the instructions but it returns nothing, empty directory new_dir/labels
@Mary14-design hi there! It sounds like there might be an issue with how the script is locating the JSON file or parsing its contents. Could you double-check the path to instances_train2017.json
is correct and accessible in your script? Make sure the path exactly matches the directory structure where your JSON file is stored.
Additionally, verify that your JSON file is properly formatted and not empty. If the file and path are correct, try adding some print statements in the script to see if it's reading the file and entering the conversion loop.
If you're still facing issues, please provide more details such as the command you used to run the script, and we’ll be glad to assist further! 😊
Hi @Mary14-design, thanks for writing the issue.
python general_json2yolo.py
from the JSON2YOLO folder.
Thanks for your code, I'm trying to convert the keypooints.json file to Yolo format using your code in colab. The code runs fine and creating a new folder with images, labels but yolo format labels are not saved. Can you please let me know what is the issue. Thanks