You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Traceback (most recent call last):
File "main.py", line 60, in
main(**parse_args())
File "main.py", line 49, in main
track_video(vcap)
File "main.py", line 33, in track_video
bboxes, scores = detections.fetch_faces(frame, return_landmarks=False)
File "/home/javier/repos/deep/MtcnnMaskDetection/utils/detections.py", line 24, in fetch_faces
bboxes, landmarks = detect_faces(image)
File "/home/javier/repos/deep/lib/python3.6/site-packages/torch_mtcnn/detector.py", line 58, in detect_faces
boxes = run_first_stage(image, pnet, scale=s, threshold=thresholds[0])
File "/home/javier/repos/deep/lib/python3.6/site-packages/torch_mtcnn/first_stage.py", line 34, in run_first_stage
probs = output[1].data.numpy()[0, 1, :, :]
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.`
The text was updated successfully, but these errors were encountered:
The problem is due to torch_mtcnn pip package, which does not currently support GPU. To fix this, you can go to the source file (in your case it is /home/javier/repos/deep/lib/python3.6/site-packages/torch_mtcnn/detector.py) and
add after line 26
When running with CPU there is no issue...when I enable GPU then i get:
`(deep) deep/MtcnnMaskDetection git:(master) [D]% python main.py ../automl/efficientdet/video_calle.mp4
Downloading: "https://github.com/khrlimam/mtcnn-pytorch/releases/download/0.0.1/pnet-6b6ef92b.pth" to /home/javier/.cache/torch/checkpoints/pnet-6b6ef92b.pth
100%|##########################################################################################################| 28.1k/28.1k [00:00<00:00, 253kB/s]
Downloading: "https://github.com/khrlimam/mtcnn-pytorch/releases/download/0.0.1/rnet-b13c48bc.pth" to /home/javier/.cache/torch/checkpoints/rnet-b13c48bc.pth
100%|############################################################################################################| 394k/394k [00:00<00:00, 616kB/s]
Downloading: "https://github.com/khrlimam/mtcnn-pytorch/releases/download/0.0.1/onet-60cc8dd5.pth" to /home/javier/.cache/torch/checkpoints/onet-60cc8dd5.pth
100%|##########################################################################################################| 1.49M/1.49M [00:02<00:00, 559kB/s]
Traceback (most recent call last):
File "main.py", line 60, in
main(**parse_args())
File "main.py", line 49, in main
track_video(vcap)
File "main.py", line 33, in track_video
bboxes, scores = detections.fetch_faces(frame, return_landmarks=False)
File "/home/javier/repos/deep/MtcnnMaskDetection/utils/detections.py", line 24, in fetch_faces
bboxes, landmarks = detect_faces(image)
File "/home/javier/repos/deep/lib/python3.6/site-packages/torch_mtcnn/detector.py", line 58, in detect_faces
boxes = run_first_stage(image, pnet, scale=s, threshold=thresholds[0])
File "/home/javier/repos/deep/lib/python3.6/site-packages/torch_mtcnn/first_stage.py", line 34, in run_first_stage
probs = output[1].data.numpy()[0, 1, :, :]
TypeError: can't convert CUDA tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.`
The text was updated successfully, but these errors were encountered: