Yolov5: ModuleNotFoundError: No module named 'models.yolo'

Created on 15 Jun 2020  路  5Comments  路  Source: ultralytics/yolov5

Traceback (most recent call last):
File "C:/projects/YOLOV5/yolov5/train.py", line 412, in
train(hyp)
File "C:/projects/YOLOV5/yolov5/train.py", line 88, in train
model.load_state_dict(torch.load(new_weights))
File "C:Python36libsite-packagestorchserialization.py", line 368, in load
return _load(f, map_location, pickle_module)
File "C:Python36libsite-packagestorchserialization.py", line 542, in _load
result = unpickler.load()
ModuleNotFoundError: No module named 'models.yolo'

Most helpful comment

I solved the problem by add init.py to models folder

I have added the __init__.py (empty file) to the models folder, but still I get the error no module named 'models.yolo'

All 5 comments

Hello @tangxiaochu123230, 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 that 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:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

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

@tangxiaochu123230 please provide minimum viable code to reproduce your issue, otherwise we can not help you.

I solved the problem by add __init__.py to models folder

@tangxiaochu123230 perfect. This has already been done in a commit recently. Pleasee update your repo with git pull or reclone.

I solved the problem by add init.py to models folder

I have added the __init__.py (empty file) to the models folder, but still I get the error no module named 'models.yolo'

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abhiksark picture abhiksark  路  3Comments

DucTaiVu picture DucTaiVu  路  3Comments

we1pingyu picture we1pingyu  路  3Comments

lisa676 picture lisa676  路  3Comments

milind-soni picture milind-soni  路  3Comments