tusharsarkar3 / Detect_Drone

Drone detection using YOLOv5

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Torch error

tuantdang opened this issue · comments

PS D:\refcode\Detect_Drone> python detect.py --source ..\drone_1.MP4
detect: weights=yolov5s.pt, source=..\drone_1.MP4, imgsz=640, conf_thres=0.25, iou_thres=0.45, max_det=1000, device=, view_img=False, save_txt=False, save_conf=False, save_crop=False, nosave=False, classes=None, agnostic_nms=False, augment=False, update=False, project=runs/detect, name=exp, exist_ok=False, line_thickness=3, hide_labels=False, hide_conf=False, half=False
YOLOv5 2021-6-30 torch 1.10.0+cpu CPU

Traceback (most recent call last):
File "D:\refcode\Detect_Drone\detect.py", line 222, in
main(opt)
File "D:\refcode\Detect_Drone\detect.py", line 217, in main
run(**vars(opt))
File "C:\Python39\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "D:\refcode\Detect_Drone\detect.py", line 66, in run
model = attempt_load(weights, map_location=device) # load FP32 model
File "D:\refcode\Detect_Drone\models\experimental.py", line 120, in attempt_load
ckpt = torch.load(w, map_location=map_location) # load
File "C:\Python39\lib\site-packages\torch\serialization.py", line 607, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "C:\Python39\lib\site-packages\torch\serialization.py", line 882, in _load
result = unpickler.load()
File "C:\Python39\lib\site-packages\torch\serialization.py", line 875, in find_class
return super().find_class(mod_name, name)
AttributeError: Can't get attribute 'SPPF' on <module 'models.common' from 'D:\refcode\Detect_Drone\models\common.py'>

@tuantdang you could manually download older model file yolov5s.pt from earlier version of YOLOv5 here then make work with this model via --weights argument. But in fact this is generic model of YOLOv5 which is doesn't detect drones. You should use weights which is located in exp27/weights folder of this repository