Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError : No module named 'models'

I'm using YOLOv5, clone from its official github repo.

During the training I got the following error:

Traceback (most recent call last):
  File "C:\Users\nived\Untitled Folder 1\train.py", line 40, in <module>
    import models
ModuleNotFoundError: No module named 'models'

Train command:

!python train.py --img 416 --batch 16 --epochs 150 --data relative/path/to/data.yaml --weights yolov5s.pt --cache*
like image 624
NIVEDITHA J Avatar asked Oct 16 '25 10:10

NIVEDITHA J


1 Answers

Please add mentioned code in the top two lines of the detect.py file and it will work then,

import sys
sys.path.insert(0, './yolov5')

For more details, you can visit link from YOLOv5 Repository

like image 171
Muhammad Rizwan Munawar Avatar answered Oct 19 '25 12:10

Muhammad Rizwan Munawar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!