[Yolact data set production - labelme use and transfer to coco detailed explanation]

The data processing of labelme2coco is
mainly divided into two parts: 1. Use labelme to mark samples to obtain json files; 2. Convert json files to coco datasets
Two parts of source code jump:
Mark: https://github.com/wkentaro/labelme )
to coco: https://github.com/wkentaro/labelme/tree/main/examples/instance_segmentation

json to coco dataset

  • Enter the instance_segmentation folder
    Open the labelme code we downloaded before , activate the environment as labelme and go to the
    labelme-main/examples/instance_segmentation folder

  • insert image description here

     
    Explain here, after entering the instance_segmentation folder, data_annotated is the folder where your sample data and json are stored. You can put your training data and json files in this directory. data_dataset_coo is a folder generated after running, which contains sample data and coco label data

    Copy the training samples to data_annotated and modify the labels.txt file

    insert image description here
    Enter the terminal, cd to the instance_segmentation directory, and enter the following code

    ./labelme2coco.py data_annotated data_dataset_coco --labels labels.txt
    insert image description here

    After the operation is completed, a data_dataset_coo folder is generated. At this point, the coco file of the train sample is completed, and the coco file of the val sample can repeat the above steps.

    insert image description here
    3. Put it in the specified folder
    The file directory is as follows, the folder in the yellow box should be created by yourself, the red box is the copied sample data generated before, the blue box is the coco label annotations.json generated in the previous step,
    You need to rename the content as shown and copy it to the corresponding directory! !

    insert image description here 


    If you want to do good work, you must first sharpen your tools! So far, the coco instance segmentation dataset is established! ! !

    4. Troubleshooting
    4.1 Exit without reason in the middle of the process
    . Question 1: When generating the data_dataset_coco folder of the coco dataset, it automatically exits after converting some data and the annotations.json file is not generated.

    Solution: Data set problem, check whether each image in the data set has a corresponding json file, and delete the images without json files.

    Question 2: Every time the data set is converted to xxx (such as 477), it stops automatically without any error

    Solution: Find several images before and after the 477th corresponding image, there may be image problems, just delete the wrong image

    Problem 3: Unknown error

    Solution: Re-run the code after deleting the generated data_dataset_coco folder

Guess you like

Origin blog.csdn.net/qq_42262610/article/details/124339419