yolov9 icon indicating copy to clipboard operation
yolov9 copied to clipboard

how to train custom data

Open cnjhh opened this issue 1 year ago • 4 comments

cnjhh avatar Feb 23 '24 04:02 cnjhh

Make sure your dataset has same format as provided format for coco dataset. Modify the coco.yaml and yolov9.yaml to fit your dataset. Then you can train your custom data.

WongKinYiu avatar Feb 23 '24 05:02 WongKinYiu

Hi, @cnjhh and @WongKinYiu. I spent some time assembling this notebook. It shows how to:

  • Run inference with a pre-trained model
  • Fine-tune models on custom dataset
  • Evaluate fine-tuned model
  • Run inference with fine-tuned model

@WongKinYiu I'd love to add this link to README.md, but I understand if you prefare not to. :)

SkalskiP avatar Feb 23 '24 09:02 SkalskiP

Done.

WongKinYiu avatar Feb 23 '24 09:02 WongKinYiu

@WongKinYiu Thank you! 🙏🏻 I'm super honored. Maybe we could include a badge at the top of the README?

Colab

SkalskiP avatar Feb 23 '24 11:02 SkalskiP

Hi @WongKinYiu @SkalskiP, is there any way to perform fine-tuning on the model using a custom dataset with different structure than the one used in the Colab(YOLO structure)?

I want to use it for a dataset with a different structure and I would like to know if you have some hints on how to carry this out. I have a lot of data and it is not efficient for me to transform that bunch of data into the YOLO structure, I would like to have a 'general' approach in order to be able to train it with different dataset structures. My structure is in this case is:

├── src
│   ├── images
│   │   ├── <class_directory>/<image>.jpg
│   ├── bounding_boxes.txt
│   ├── classes.txt
│   ├── image_class_labels.txt
│   ├── images.txt
│   ├── train_test_splits.txt

Thanks in advance.

berengueradrian avatar Mar 06 '24 11:03 berengueradrian

@berengueradrian I guess it is not possible to create a 'general approach' that supports all possible user's dataset structures. That's why we have different data formats (COCO, YOLO, etc). The code can be refactored to expect the user's dataloader, but it would take some time to properly refactor. So, I guess you can use your own custom dataloader and insert it here https://github.com/WongKinYiu/yolov9/blob/380284cb66817e9ffa30a80cad4c1b110897b2fb/train.py#L177 Just make sure your dataloader outputs the data in the expected format. 

rmukh avatar Mar 07 '24 15:03 rmukh

All right, thanks for the info!

berengueradrian avatar Mar 08 '24 10:03 berengueradrian