0

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

Ruzihm
  • 19,749
  • 5
  • 36
  • 48
  • 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. – alexheat Dec 03 '21 at 04:33
  • Thank you so much @alexheat for your answer! i will test my code in colab as you suggested and let you know if it works fine. Regarding the labels i checked their setup and do some visualizations that showed that the box are as it should be and looked fine, for the classes i have just one class and the label for that class is 0 as yolov5 starts with 0 for one label and 1 for the second label if there is seconde label ans so one. – Data science folk Dec 03 '21 at 17:22
  • i dont know if that has relation with my problem ( dividing by 0 as an example somewhere in my model code implementation because i didn't write the code myself i took the code of yolov5 as it it's so i don't know the steps and the operations made inside the code). – Data science folk Dec 03 '21 at 17:22

3 Answers3

0

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

  • Your welcome. If you like my answer please accept my answer. I have been doing it on Google Colab myself because I can't get it to work on my own laptop either – alexheat Dec 04 '21 at 12:15
  • done (y) i searched a little bit and found that the problem maybe came from the version of torch, because in my laptop as i mentioned before i have 1.10.0+cu113 but in the tutorial of yolov5 they worked with 1.10.0+cu111, maybe you can try it with this version and see if it works :) i didn't try it yet myself but if i do i will let you know the result ! – Data science folk Dec 04 '21 at 17:19
0

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

alexheat
  • 479
  • 5
  • 9
0

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.

Vijay P
  • 43
  • 1
  • 4