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

How to use detect.py? #115

Open
zhuolisam opened this issue Jun 18, 2023 · 0 comments
Open

How to use detect.py? #115

zhuolisam opened this issue Jun 18, 2023 · 0 comments
Labels
question Further information is requested

Comments

@zhuolisam
Copy link

❔Question

I am trying to use detect.py to inference on my own videos. I have obtained the weights from http://software-dl.ti.com/jacinto7/esd/modelzoo/gplv3/08_02_00_11/edgeai-yolov5/pretrained_models/checkpoints/keypoint/coco/edgeai-yolov5/yolov5s6_640_ti_lite_54p9_82p2/weights/last.pt and placed it in my root dir.

Then I run the script to first test it on the zidane.jpg

python detect.py --source data/images/zidane.jpg --weights last.pt --device 0

but I got this error:

C:\Users\zhuol\anaconda3\envs\openmm\lib\site-packages\torch\nn\functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at  ..\c10/core/TensorImpl.h:1156.)
  return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
Model Summary: 302 layers, 12546076 parameters, 0 gradients
image 1/1 C:\Users\zhuol\OneDrive - Universiti Malaya\Documents\SELFLEARN\Machine Learning\Pose Estimation\edgeai-yolov5\data\images\bus.jpg: (3, 640, 512)
Traceback (most recent call last):
  File "detect.py", line 239, in <module>
    main(opt)
  File "detect.py", line 234, in main
    run(**vars(opt))
  File "C:\Users\zhuol\anaconda3\envs\openmm\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "detect.py", line 99, in run
    model(torch.zeros(1, 3, imgsz, imgsz).to(device).type_as(next(model.parameters())))  # run once
  File "C:\Users\zhuol\anaconda3\envs\openmm\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\zhuol\OneDrive - Universiti Malaya\Documents\SELFLEARN\Machine Learning\Pose Estimation\edgeai-yolov5\models\yolo.py", line 122, in forward
    return self.forward_once(x, profile, visualize)  # single-scale inference, train
  File "C:\Users\zhuol\OneDrive - Universiti Malaya\Documents\SELFLEARN\Machine Learning\Pose Estimation\edgeai-yolov5\models\yolo.py", line 153, in forward_once
    x = m(x)  # run
  File "C:\Users\zhuol\anaconda3\envs\openmm\lib\site-packages\torch\nn\modules\module.py", line 1051, in _call_impl
    return forward_call(*input, **kwargs)
  File "C:\Users\zhuol\OneDrive - Universiti Malaya\Documents\SELFLEARN\Machine Learning\Pose Estimation\edgeai-yolov5\models\yolo.py", line 54, in forward
    x[i] = x[i].view(bs, self.na, self.no, ny, nx).permute(0, 1, 3, 4, 2).contiguous()
RuntimeError: shape '[1, 3, 57, 80, 80]' is invalid for input of size 115200

Can anyone enlighten me what did I do wrong?

Additional context

@zhuolisam zhuolisam added the question Further information is requested label Jun 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant