ultralytics / yolov5

YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
49.69k stars 16.11k forks source link

How to get the related class labels from Mosaic augmentation? #1144

Closed innat closed 3 years ago

innat commented 3 years ago

I'm trying to get the related class label from mosaic augmentation for multi-class object detection. I'm not using Yolo5 but the mosaic implementation in my case inspired by Yolo implementation. I described my query in more detail over here, SO. Please, have a look.

github-actions[bot] commented 3 years ago

Hello @innat, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

For more information please visit https://www.ultralytics.com.

glenn-jocher commented 3 years ago

@innat if you are looking for multi-class object detection, I would simply use YOLOv5, which already incorporates all the mosaic augmentation you want.

innat commented 3 years ago

@glenn-jocher Could you please point me to the specific code snippet where the mosaic augmentation in Yolo5 deals with such cases? So, that I can understand when it randomly making a mosaic, how it tracks the labels in final results.

glenn-jocher commented 3 years ago

@innat of course. load_mosaic() in datasets.py is responsible for all mosaic activity. Your dataset trains with Mosaic by default in YOLOv5, no extra action is needed on your part, simply python train.py --data custom.yaml

https://github.com/ultralytics/yolov5/blob/4d3680c81dad760e5d1ffe397ab2fc9169d9fb70/utils/datasets.py#L643-L699

glenn-jocher commented 3 years ago

You can also view your mosaics during training. Suggest you start with the custom training tutorial, it explains all of this already. https://docs.ultralytics.com/yolov5

train_batch0

innat commented 3 years ago

Thanks for the pointer and suggestion. -)

innat commented 3 years ago

The problem is solved. Here is the answer, leaving it here for future readers.