Open sunguwei opened 6 years ago
I also meet this issue. Have you solve it?
same issue
You can call .cuda() or to('gpu:0') to move model to gpu. For example:
pnet = Pnet().cuda()
output = pnet(input_tensor)
Like this, For example:
pnet.cuda() rnet.cuda() onet.cuda() offsets = output[0].cpu().data.numpy() probs = output[1].cpu().data.numpy()
finish the rest like that
Hi sunguwei,
I just refactor this repo, you can check it in https://github.com/mayuanjason/MTCNN_face_detection_alignment_pytorch
It can run on GPU.
Here are some improvments I made: • Transfer all numpy operation to torch operation, so that it can benefit from GPU acceleration. • Automatic run on 'CPU' or 'GPU'. • Based on the latest version of pytorch (1.3) • Real-time face tracking
I found that it is a bit slow when I run this code. Then I check the usage of gpu and I found this code was run on the cpu. So I want to change the code to run on the gpu. But I found the type of weight of this model is torch.FloatTensor. Is that mean I cannot use the gpu to run this code directly? Is that any solution can help me to run this code on gpu?
Here is the error:
RuntimeError: Expected object of type torch.FloatTensor but found type torch.cuda.FloatTensor for argument #2 'weight'