-
-
Notifications
You must be signed in to change notification settings - Fork 15.9k
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
How to load a custom model? #9802
Comments
👋 Hello @int3r5t377ar, thank you for your interest in YOLOv5 🚀! Please visit our ⭐️ Tutorials to get started, where you can find quickstart guides for simple tasks like Custom Data Training all the way to advanced concepts like Hyperparameter Evolution. 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 training ❓ Question, please provide as much information as possible, including dataset images, training logs, screenshots, and a public link to online W&B logging if available. For business inquiries or professional support requests please visit https://ultralytics.com or email support@ultralytics.com. RequirementsPython>=3.7.0 with all requirements.txt installed including PyTorch>=1.7. To get started: git clone https://github.com/ultralytics/yolov5 # clone
cd yolov5
pip install -r requirements.txt # install EnvironmentsYOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
StatusIf this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are currently passing. CI tests verify correct operation of YOLOv5 training, validation, inference, export and benchmarks on MacOS, Windows, and Ubuntu every 24 hours and on every commit. |
@int3r5t377ar the error is telling you that there is no file in the location you specified:
Windows loading of YOLOv5 PyTorch Hub models is run every 24 hours and operates correctly: yolov5/.github/workflows/ci-testing.yml Lines 133 to 135 in 16f87bb
|
What should I do to use the |
Looks like user error due a mispelling. You've got a *.bt suffix which you probably meant to write as *.pt |
Oh thank you so much. I overlooked such a simple mistake over long time. And it works fine now. I am gonna close this question. |
can you help me I'm using torch 1.11.0+cu113 import torch I gotFile ".\load3.py", line 3, in |
In the first argument of torch.hub.load write the path of yolo directory. |
@Sha312003 your error message suggests that your current directory does not contain a file called import torch
path = 'yolov5s.pt'
model = torch.hub.load('ultralytics/yolov5', 'custom', path=path, source='local')
print(model(torch.randn(1,3,640,640)))) This code loads the |
tengo un error model = torch.hub.load('ultralytics/yolov5','custom', para subir mi modelo personalizable no reconoce,no se si alguien le paso |
Hola! Parece que estás enfrentado un problema al cargar tu modelo personalizado. Asegúrate que la ruta al archivo Tu código parece estar mayormente correcto, solo verifica la ruta. Aquí tienes un ejemplo ligeramente ajustado para asegurarnos que se usa correctamente: import torch
model = torch.hub.load('ultralytics/yolov5', 'custom', path='D:/python/pythonProject/model/carros.pt', force_reload=True) Si el modelo sigue sin reconocer, verifica que |
Search before asking
Question
I use the code
model = torch.hub.load('ultralytics/yolov5', 'custom', path='C:/Users/Documents/yolov5/runs/train/exp/weights/best.bt', force_reload=True)
to load the custom model I have trained.
The code is found in the internet and it works for the examples I referenced at.
But for me, it keeps generating errors:
Also, I have no idea why the path becomes
'C:\\Users\\Documents\\yolov5\\runs\\train\\exp\\weights\\best.bt'
.Additional
No response
The text was updated successfully, but these errors were encountered: