'Yolov5 object detection training

Please i need you help concerning my yolov5 training process for object detection!

I try to train my object detection model yolov5 for detecting small object ( scratch). For labelling my images i used roboflow, where i applied some data augmentation and some pre-processing that roboflow offers as a services. when i finish the pre-processing step and the data augmentation roboflow gives the choice for different output format, in my case it is yolov5 pytorch, and roboflow does everything for me splitting the data into training validation and test. Hence, Everything was set up as it should be for my data preparation and i got at the end the folder with data.yaml and the images with its labels, in data.yaml i put the path of my training and validation sets as i saw in the GitHub tutorial for yolov5. I followed the steps very carefully tought.

The problem is when the training start i get nan in the obj and box column as you can see in the picture bellow, that i don't know the reason why, can someone relate to that or give me any clue to find the solution please, it's my first project in computer vision.

This is what i get when the training process starts

This the last message error when the training finish

I think the problem comes maybe from here but i don't know how to fix it, i used the code of yolov5 team as it's in the tuto

The training continue without any problem but the map and precision remains 0 all the process !!

Ps : Here is the link of tuto i followed : https://github.com/ultralytics/yolov5/wiki/Train-Custom-Data



Solution 1:[1]

This is what I would do to troubleshoot it. - Run your code on collab because the environment is proven to work well - Confirm that your labels look good and are setup correctly. Can you checked to ensure the classes look right? In one of the screenshots it looks like you have no labels

Solution 2:[2]

Running my code in colab worked successfully and the resulats were good. I think that the problem was in my personnel laptop environment maybe the version of pytorch i was using '1.10.0+cu113', or something else ! If you have any advices to set up my environnement for yolov5 properly i would be happy to take from you guys. many Thanks again to @alexheat

Solution 3:[3]

I'm using Yolov5 for my custom dataset too. This problem might be due to the directory misplacement. And using different version of Pytorch will not be a problem. Anyway you can try using the version they mentioned in 'requirements.txt' It's better if you run

cd yolov5

pip3 install -r requirements.txt

Let me know if this helps.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 alexheat
Solution 2 Data science folk
Solution 3 Vijay P