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
{{ message }}
Repository navigation
TypeError: can't convert cuda:0 device type tensor to numpy. #83
Hello~,Thanks for your work! when I run demo.py I meet an error:
loading pretrained resnet model
Finished loading model!
Error bbox number to filter : 0, bbox number: 0
Finished loading data
loading pretrained resnet model
Finished loading model!
/home/felix/PycharmProjects/yolov5/yolov5_venv/lib/python3.8/site-packages/torch/nn/functional.py:3328: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.
warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.")
/home/felix/PycharmProjects/yolov5/yolov5_venv/lib/python3.8/site-packages/torch/nn/functional.py:3454: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
warnings.warn(
Traceback (most recent call last):
File "/home/felix/PycharmProjects/FaceDetection-DSFD/demo.py", line 232, in <module>
test_oneimage()
File "/home/felix/PycharmProjects/FaceDetection-DSFD/demo.py", line 200, in test_oneimage
det0 = infer(net, img, transform, thresh, cuda, shrink)
File "/home/felix/PycharmProjects/FaceDetection-DSFD/demo.py", line 94, in infer
det = torch.from_numpy(np.array(det))
File "/home/felix/PycharmProjects/yolov5/yolov5_venv/lib/python3.8/site-packages/torch/tensor.py", line 621, 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.
Activity
dsbyprateekg commentedon Dec 22, 2021
@chaotianjiao I am also facing the same error. Have you resolved it?