ultralytics / yolov5

YOLOv5 πŸš€ in PyTorch > ONNX > CoreML > TFLite
https://docs.ultralytics.com
GNU Affero General Public License v3.0
51.02k stars 16.41k forks source link

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

Open plt2mek opened 2 months ago

plt2mek commented 2 months ago

Search before asking

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?

glenn-jocher commented 2 months ago

@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.