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

error in detect.py #73

Open
ZeeshanKhalid2k01 opened this issue Oct 17, 2023 · 1 comment
Open

error in detect.py #73

ZeeshanKhalid2k01 opened this issue Oct 17, 2023 · 1 comment

Comments

@ZeeshanKhalid2k01
Copy link

when i run detect.py i am facing some issue hen trying to save the crop images by using command --save-crop.
kindly help me to resolve this issue

error :

computer_vision_project\yolov7-face-github\yolov7-face>python detect.py --weights yolov7-face.pt --source 0 --device 0 --save-crop

Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.25, device='0', exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.45, kpt_label=5, line_thickness=3, name='exp', nosave=False, project='runs/detect', save_bin=False, save_conf=False, save_crop=True, save_txt=False, save_txt_tidl=False, source='0', update=False, view_img=False, weights=['yolov7-face.pt'])
YOLOv5 198076d torch 1.7.0+cu101 CUDA:0 (Quadro P1000, 4095.8125MB)

Fusing layers...
Model Summary: 315 layers, 36562547 parameters, 0 gradients, 103.4 GFLOPS
1/1: 0... success (640x480 at 30.00 FPS).

tensor(0.89844, device='cuda:0')
Traceback (most recent call last):
File "detect.py", line 203, in
detect(opt=opt)
File "detect.py", line 122, in detect
save_one_box(xyxy, im0s, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True)
File "E:\NCSEAL\computer_vision_project\yolov7-face-github\yolov7-face\utils\general.py", line 725, in save_one_box
clip_coords(xyxy, shape)
NameError: name 'shape' is not defined

@MyraBaba
Copy link

python3 detect.py --weights models/yolov7-face.pt --conf 0.25 --source data/images/22_Picnic_Picnic_22_10.jpg --nosave
Namespace(weights=['models/yolov7-face.pt'], source='data/images/22_Picnic_Picnic_22_10.jpg', img_size=640, conf_thres=0.25, iou_thres=0.45, device='', view_img=False, save_txt=False, save_txt_tidl=False, save_bin=False, save_conf=False, save_crop=False, nosave=True, 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, kpt_label=5)
YOLOv5 � 198076d torch 2.1.1+cu121 CUDA:0 (NVIDIA GeForce RTX 2080 Ti, 11008.625MB)

Fusing layers...
/home/alp2080/Projects/yolov7/venvYolov7/lib/python3.10/site-packages/torch/functional.py:504: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at ../aten/src/ATen/native/TensorShape.cpp:3526.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Model Summary: 315 layers, 36562547 parameters, 0 gradients, 103.4 GFLOPS
image 1/1 /data/OpenSource/yolov7-face/data/images/22_Picnic_Picnic_22_10.jpg: tensor(0.86133, device='cuda:0')
Traceback (most recent call last):
File "/data/OpenSource/yolov7-face/detect.py", line 202, in
detect(opt=opt)
File "/data/OpenSource/yolov7-face/detect.py", line 79, in detect
pred = non_max_suppression(pred, opt.conf_thres, opt.iou_thres, classes=opt.classes, agnostic=opt.agnostic_nms, kpt_label=kpt_label)
File "/data/OpenSource/yolov7-face/utils/general.py", line 514, in non_max_suppression
nc = prediction.shape[2] - 5 if not kpt_label else prediction.shape[2] - 5 - kpt_label * 3 # number of classes
IndexError: tuple index out of range

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants