xinntao / facexlib

FaceXlib aims at providing ready-to-use face-related functions based on current STOA open-source methods.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: can't convert cuda:0 device type

m-pektas opened this issue · comments

I can run this package in different environments correctly but when i used the mentioned environment below I got following error:

self.face_helper.get_face_landmarks_5(only_center_face=only_center_face, eye_dist_threshold=5)
  File "/usr/local/lib/python3.8/dist-packages/facexlib/utils/face_restoration_helper.py", line 139, in get_face_landmarks_5
    bboxes = self.face_det.detect_faces(input_img, 0.97) * scale
  File "/usr/local/lib/python3.8/dist-packages/facexlib/detection/retinaface.py", line 228, in detect_faces
    bounding_boxes, landmarks = bounding_boxes[keep, :], landmarks[keep]
  File "/usr/local/lib/python3.8/dist-packages/torch/_tensor.py", line 970, in __array__
    return self.numpy()
TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

Environment info:

Docker
Based on nvcr.io/nvidia/tensorrt:21.12-py3 image.
Python 3.8.10
Pip env: env.txt

As I understand, this problem is not related to environment. It is working correctly when i isolete the default usage. It about my other files and importing.