facenet-pytorch icon indicating copy to clipboard operation
facenet-pytorch copied to clipboard

Small fix to prevent issues when using a gpu.

Open sotelo opened this issue 1 month ago • 0 comments

Hello! Awesome lib!

In the current version of the code, I get a TypeError: can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first. I isolated this issue to this line: https://github.com/timesler/facenet-pytorch/blob/8ee5326dc904f88846ca014a3d047b08392bd12f/models/utils/detect_face.py#L376

When face is already a gpu tensor, there's no need to convert to a np array and then to a tensor. LMK if this looks good to you or if you'd want to change something.

sotelo avatar May 10 '24 20:05 sotelo