You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
That's it. I uploaded my own dataset on the Ultralytics hub, chose pre train=True, and made minor adjustments to Yolov5l6u. Now I have a weight. pt weight file, but I have cloned the source code of Yolov5 and cannot detect it properly.
Traceback (most recent call last):
File "detect.py", line 261, in <module>
main(opt)
File "detect.py", line 256, in main
run(**vars(opt))
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "detect.py", line 98, in run
model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half)
File "/media/hang/软件/Obejct/yolov5/models/common.py", line 344, in __init__
model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)
File "/media/hang/软件/Obejct/yolov5/models/experimental.py", line 80, in attempt_load
ckpt = (ckpt.get('ema') or ckpt['model']).to(device).float() # FP32 model
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 673, in to
return self._apply(convert)
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/ultralytics/nn/tasks.py", line 146, in _apply
self = super()._apply(fn)
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 387, in _apply
module._apply(fn)
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 387, in _apply
module._apply(fn)
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 387, in _apply
module._apply(fn)
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 409, in _apply
param_applied = fn(param)
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/nn/modules/module.py", line 671, in convert
return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
RuntimeError: CUDA error: unknown error
Traceback (most recent call last):
File "detect.py", line 261, in <module>
main(opt)
File "detect.py", line 256, in main
run(**vars(opt))
File "/home/hang/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "detect.py", line 160, in run
s += f"{n} {names[int(c)]}{'s' * (n > 1)}, " # add to string
KeyError: 2474
Additional
In addition, I know that when pre train=True, pre training will be based on the fine-tuned weights of the COCO dataset. I don't know if it already contains some category information, so when reasoning, I need to add my own dataset label and COCO dataset label to data.yaml.
I don't know if my guess is correct, but I guess it's because of data.ymal, which makes it impossible to reason
It may be that the current source code of YOLOv5 does not support running this YOLOv5l6u checkpoint
The text was updated successfully, but these errors were encountered:
@xiaohangguo based on the error messages you provided, it seems that there are a few issues with your setup.
First, regarding the orientation Meta error, it seems like you have modified the code to use a different enumeration for the self.orientation property. You mentioned that you changed it to self.orientation = int(self.cap.get(48)) but it is unclear what 48 corresponds to. It might be worth looking into the cv2.CAP_PROP_ORIENTATION_META enumeration to make sure that you are using the correct value.
Second, the CUDA error suggests that there might be an issue with the installation of CUDA on your system. I would recommend verifying your CUDA installation by running the nvidia-smi command to ensure that your GPU is being properly detected and that the correct version of CUDA is installed.
Finally, the KeyError that you encountered might be caused by a mismatch between your data.yaml file and your training data. It looks like the error is coming from the names[int(c)] expression, which suggests that the model is trying to map an index that is not defined in your names list. You may want to double-check that your data is correctly labeled and that your data.yaml file matches your data format. You can also try running the detection script with the --verbose flag to get additional debug information.
Search before asking
Question
That's it. I uploaded my own dataset on the Ultralytics hub, chose pre
train=True
, and made minor adjustments to Yolov5l6u. Now I have aweight. pt
weight file, but I have cloned the source code of Yolov5 and cannot detect it properly.First wrong:
self.orientation = int(self.cap.get(cv2.CAP_PROP_ORIENTATION_META))
i modify .
self.orientation = int(self.cap.get(48)) # rotation degrees
and second run:
third run: i using the scl:
python detect.py --source fire.mkv --data data.yaml
data.yaml is my datasets yaml :
##and get wrong:
Additional
In addition, I know that when pre
train=True,
pre training will be based on the fine-tuned weights of the COCO dataset. I don't know if it already contains some category information, so when reasoning, I need to add my own dataset label and COCO dataset label to data.yaml.The text was updated successfully, but these errors were encountered: