Closed Ishihara-Masabumi closed 1 year ago
@Ishihara-Masabumi it seems that model weights are on the GPU, but resize image array is on the CPU. So, you need to send your input tensors to the GPU. add this line after resizing.
orig_image.to("cuda")
I hope it will resolve your issue.
Thank you for your support. BTW, the message from the run using 'orig_image.to("cuda")' is as follows:
Optimizer stripped from yolov7-w6-pose.pt, 161.1MB
Fusing layers...
Frame 0 Processing
Traceback (most recent call last):
File "pose-estimate.py", line 173, in <module>
main(opt)
File "pose-estimate.py", line 168, in main
run(**vars(opt))
File "/home/********/.local/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 28, in decorate_context
return func(*args, **kwargs)
File "pose-estimate.py", line 77, in run
orig_image.to("cuda")
AttributeError: 'numpy.ndarray' object has no attribute 'to'
@Ishihara-Masabumi Well! I have tested with resize on both GPU and CPU (Windows and Linux machines), its works fine. Even I not transferred the data to "cuda". Seems like you are using CPU and GPU both in parallel mode, or GPU memory was not cleared yet. For more details, you can take a look at mentioned link below. https://discuss.pytorch.org/t/converting-numpy-array-to-tensor-on-gpu/19423
@Ishihara-Masabumi I am closing this issue, due to inactivity for a long time. Also, I have tested the code, and there is no issue coming that you mentioned. Feel free to open a new issue, if you will face an issue, but try to provide complete Information for testing.
I tried to run on many resize sizes. Then, I found that some resizees are accessible but others are not accessible and give errors. Please let me know the rule to resize. Thanks.
@Ishihara-Masabumi! You will need to resize the image by keeping in mind the aspect ratio concept, otherwise, the code will throw an error. i.e acceptable resize start from 640 360, 1280 720 etc.
Thanks.
I resized the frame size in pose-estimate.py as below.
But, the following error occured.