-
-
Notifications
You must be signed in to change notification settings - Fork 16.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in loading yolov5 in local windows 11 #13500
Comments
👋 Hello @pratyooshraj, thank you for your interest in YOLOv5 🚀! Your error seems related to loading your custom-trained model on your local setup. For a detailed diagnosis and resolution, we'll need some additional information. In the meantime, here are a few steps to help troubleshoot and debug: Debug Checklist 🐛
Instructions ✅For additional assistance, please:
Requirements 💡Ensure all requirements are met by running the following setup commands for YOLOv5 locally: git clone https://github.com/ultralytics/yolov5 # clone YOLOv5 repository
cd yolov5
pip install -r requirements.txt # install requirements For safe compatibility, consider running YOLOv5 in one of our verified environments. These include:
Next Steps 🔍If you're unable to resolve this, an Ultralytics engineer will assist you further soon. In the meantime:
Thank you for bringing this to our attention! 😊 |
used this command to get the YOLOversion. Trained the model on 25th jan 2025 Training command MRE
|
The error likely stems from incompatibilities between the YOLOv5 version you trained your model with and the version you're using to load it. Since you cloned the YOLOv5 repo on January 25, 2025, it may include changes that differ from the version installed via PyTorch Hub. Ensure the versions match by using the same codebase for training and inference. Instead of PyTorch Hub, try running your script directly from the cloned YOLOv5 directory: from models.common import DetectMultiBackend
model = DetectMultiBackend("D:/Programming/cuda_test/yolov5/vowels_only_5epochs.pt", device='cuda') Alternatively, ensure the latest YOLOv5 repo is cloned and retry. More details on custom model loading are available here. |
I just added: import pathlib in the python file. It worked |
@pratyooshraj thank you for sharing your workaround! While this approach can resolve the issue, it’s a modification of Python's standard library behavior and may have unintended side effects. A better solution is to ensure compatibility by using the same YOLOv5 version for both training and inference. If the issue persists, you can also try running the script directly from the cloned YOLOv5 directory after installing its dependencies. For reference, check the PyTorch Hub guide. |
Search before asking
YOLOv5 Component
Detection
Bug
Currently running windows 11 and python 3.11. I trained my custom model using yolov5 using my custom data set in google colab. The model is used to detect sign language vowels.
!python train.py --img 416 --batch 16 --epochs 10 --data '/content/YOLO_vowels/data.yaml' --cfg ./models/custom_yolov5s.yaml --weights 'yolov5s.pt' --name yolov5s_vowels_results --cache disk --workers 4
The resulting best.pt in yolov5s_vowels_results i have downloaded and renamed. But an error occurs when i run the model in my device. I also tried running the pretrained yolov5s.pt model in my local device, which runs properly. Could you help me with the error.
Code
Error
---success in pretrained model
---Error in running custom model
I tried to run my custom trained model for computer vision, trained in google colab and downloaded in windows 11. Instead of running an error occurs. However in google colab, correct detection and testing images were shown.
Environment
-YOLO -v5 ultralytics==8.3.68, torch==2.5.1+cu124
-OS: windows 11
Minimal Reproducible Example
Additional
is it due to the ultralytics version. How can i downgrade to yolov5
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: