Can't use cuda in pipnet
See original GitHub issueI want use cuda in pipnet, so I run the following code:
import torchlm
from torchlm.tools import faceboxesv2
from torchlm.models import pipnet
import cv2
image_path = '../rgb/image0/1.png'
image = cv2.imread(image_path)
torchlm.runtime.bind(faceboxesv2())
torchlm.runtime.bind(
pipnet(backbone="resnet18", pretrained=True,
num_nb=10, num_lms=98, net_stride=32, input_size=256,
meanface_type="wflw", checkpoint=None, map_location="cuda")
)
torchlm.runtime.forward(image)
Then I get a error that say:
RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the same or input should be a MKLDNN tensor and weight is a dense tensor
I know it due to my image data is still stay in cpu instead of gpu, and I need load my data to gpu. So I add a line code like following:
image = cv2.imread(image_path)
image = torch.tensor(image).cuda()
But now I get another error:
File "C:\Home\Development\Anaconda\envs\DeepLearning\lib\site-packages\torchlm\tools\_faceboxesv2.py", line 305, in apply_detecting
image_scale = cv2.resize(
cv2.error: OpenCV(4.5.5) :-1: error: (-5:Bad argument) in function 'resize'
> Overload resolution failed:
> - src is not a numpy array, neither a scalar
> - Expected Ptr<cv::UMat> for argument 'src'
It means I need pass a ndarray array instead of a torch tensor. But if I pass a ndarray, its data will stay in cpu, and I will get the first error again.
What shold I do? Hava anyone get the same error?
Issue Analytics
- State:
- Created a year ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Does CUDA support OpenCL pipe like structures?
I have been using OpenCL 2.0 on AMD GPUs until now. I was using OpenCL 2.0 because i needed to transfer data between...
Read more >An Overview of the Numerical Approaches to Water Hammer ...
This paper reviews advances in the numerical modelling of transient pressurized flow, highlighting the use of the more recently developed finite volume method...
Read more >(PDF) GPU Implementation of a Biological Electromagnetic ...
However, CUDA offers greater support tools for debugging and profiling, ... The problem here is that the prices are not stationary, thus we...
Read more >(PDF) Automatic digital twin data model generation of building ...
Therefore, we use different data sources and standards to generate a ... needed for the detection tasks but can not directly be used...
Read more >stopped-flow kinetic analysis: Topics by Science.gov
This approach makes use of inline IR analysis and an automated microreactor ... which cannot be achieved with conventional macro-stopped flow devices.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
可以安装新版本试试
是我的torch安装错误了,安装cuda版的pytorch后可以正常使用。