-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
YOLOv5u models not compatible with the YOLOv5 Repository #374
Comments
@omumbare7 Thanks for asking the question. The YOLOv5lu and YOLOv5l models are not the same, there have been some tweaks that make them incompatible. All the You will need to run inference with the from ultralytics import YOLO
# Load a model
model = YOLO('path/to/best.pt') # load a custom model
# Predict with the model
results = model('https://ultralytics.com/images/bus.jpg', save=True) # predict on an image |
thank you @kalenmike i will try this |
You're welcome @omumbare7! Please do give it a try and let us know if you encounter any other issues or have further questions. We're here to help! Remember, the key point is to use the Ultralytics package for inference if you've trained a |
Search before asking
Question
the .pt file i trained via ultralytics hub on yolov5lu, does not work on yolov5 i downloaded from ultralytics github. i have loaded the model via torch hub (yes forced reload is true) but other pt which i trained via roboflow jupyter notebook works on the yolov5 i downloaded from git. Am i missing something
the error is Exception: 'Detect' object has no attribute 'grid'. Cache may be out of date, try
force_reload=True
something with hubconf file on yolov5 master folder,
all other pt files work which i have trained using roboflow notebook on colab
Additional
YOLOv5 2023-2-21 Python-3.10.0 torch-1.13.1+cu116 CUDA:0 (NVIDIA GeForce RTX 2060, 6144MiB)
YOLOv5l summary (fused): 303 layers, 53132179 parameters, 0 gradients
Adding AutoShape...
Traceback (most recent call last):
File "C:\Users\om\Desktop\ugv proto\codes./yolov5-master\hubconf.py", line 73, in _create
return model.to(device)
File "C:\Users\om\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 989, in to
return self._apply(convert)
File "C:\Users\om\Desktop\ugv proto\codes./yolov5-master\models\common.py", line 652, in _apply
m.grid = list(map(fn, m.grid))
File "C:\Users\om\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\nn\modules\module.py", line 1269, in getattr
raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Detect' object has no attribute 'grid'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "c:\Users\om\Desktop\ugv proto\codes\track.py", line 15, in
model = torch.hub.load('./yolov5-master', 'custom', source ='local', path=a, force_reload=True)
File "C:\Users\om\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\hub.py", line 542, in load
model = _load_local(repo_or_dir, model, *args, **kwargs)
File "C:\Users\om\AppData\Local\Programs\Python\Python310\lib\site-packages\torch\hub.py", line 572, in _load_local
model = entry(*args, **kwargs)
File "C:\Users\om\Desktop\ugv proto\codes./yolov5-master\hubconf.py", line 83, in custom
return _create(path, autoshape=autoshape, verbose=_verbose, device=device)
File "C:\Users\om\Desktop\ugv proto\codes./yolov5-master\hubconf.py", line 78, in _create
raise Exception(s) from e
Exception: 'Detect' object has no attribute 'grid'. Cache may be out of date, try
force_reload=True
or see ultralytics/yolov5#36 for help.The text was updated successfully, but these errors were encountered: