Skip to content
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

tried to run yolov5 "detect.py" with pretrained model yolov8x.pt and xView.yaml #13291

Open
2 tasks done
plt2mek opened this issue Sep 2, 2024 · 1 comment
Open
2 tasks done
Labels
bug Something isn't working python Pull requests that update Python code

Comments

@plt2mek
Copy link

plt2mek commented Sep 2, 2024

Search before asking

  • I have searched the YOLOv5 issues and found no similar bug report.

YOLOv5 Component

No response

Bug

///////////////////////////////////////////////////////////////
My results 👍
//////////////////////////////////////////////////////////////
detect: weights=yolov8x.pt, source=E:\IA\splitting_3, data=data\xView.yaml, imgsz=[1024, 1024], conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_format=0, save_csv=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, visualize=False, update=False, project=runs\detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False, dnn=False, vid_stride=1
YOLOv5 2024-8-28 Python-3.9.7 torch-2.4.0+cpu CPU

Traceback (most recent call last):
File "I:\pythonProject5\detect.py", line 442, in
main(opt)
File "I:\pythonProject5\detect.py", line 437, in main
run(**vars(opt))
File "I:\pythonProject5.venv\lib\site-packages\torch\utils_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "I:\pythonProject5\detect.py", line 168, in run
model = DetectMultiBackend(weights, device=device, dnn=dnn, data=data, fp16=half)
File "I:\pythonProject5\models\common.py", line 489, in init
model = attempt_load(weights if isinstance(weights, list) else w, device=device, inplace=True, fuse=fuse)
File "I:\pythonProject5\models\experimental.py", line 98, in attempt_load
ckpt = torch.load(attempt_download(w), map_location="cpu") # load
File "I:\pythonProject5.venv\lib\site-packages\ultralytics\utils\patches.py", line 86, in torch_load
return _torch_load(*args, **kwargs)
File "I:\pythonProject5.venv\lib\site-packages\torch\serialization.py", line 1065, in load
with _open_file_like(f, 'rb') as opened_file:
File "I:\pythonProject5.venv\lib\site-packages\torch\serialization.py", line 468, in _open_file_like
return _open_file(name_or_buffer, mode)
File "I:\pythonProject5.venv\lib\site-packages\torch\serialization.py", line 449, in init
super().init(open(name, mode))
FileNotFoundError: [Errno 2] No such file or directory: 'yolov8x.pt'

Environment

No response

Minimal Reproducible Example

my changes in the default code :
parser.add_argument("--weights", nargs="+", type=str, default=ROOT / "yolov8x.pt", help="model path or triton URL")
#parser.add_argument("--source", type=str, default=ROOT / "data/images", help="file/dir/URL/glob/screen/0(webcam)")
parser.add_argument("--source", type=str, default= "E:\IA\splitting_3", help="file/dir/URL/glob/screen/0(webcam)")
parser.add_argument("--data", type=str, default=ROOT / "data/xView.yaml", help="(optional) dataset.yaml path")

Additional

No response

Are you willing to submit a PR?

  • Yes I'd like to help by submitting a PR!
@plt2mek plt2mek added the bug Something isn't working label Sep 2, 2024
@UltralyticsAssistant UltralyticsAssistant added the python Pull requests that update Python code label Sep 2, 2024
@glenn-jocher
Copy link
Member

@plt2mek it looks like you're trying to use a YOLOv8 model with YOLOv5 code. YOLOv8 models are not compatible with YOLOv5. Please use a YOLOv5 model, such as yolov5x.pt, with the detect.py script. If the issue persists, ensure you're using the latest version of the YOLOv5 repository and dependencies. For further details, refer to the YOLOv5 documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working python Pull requests that update Python code
Projects
None yet
Development

No branches or pull requests

3 participants