BlazePalm icon indicating copy to clipboard operation
BlazePalm copied to clipboard

RuntimeError: expected scalar type Byte but found Float

Open zy1996829 opened this issue 1 year ago • 1 comments

Hello, I get this error when I ran run_detector.py,I want to know how to solve it

/home//zhouyan1/anaconda3/envs/gesture_recognition/bin/python /home/SENSETIME/zhouyan1/PycharmProjects/BlazePalm-master/ML/run_detector.py Traceback (most recent call last): File "/home//zhouyan1/PycharmProjects/BlazePalm-master/ML/run_detector.py", line 39, in _, _, landmarks = hl(torch.from_numpy(cropped_hand).permute((2, 0, 1)).unsqueeze(0)) File "/home//zhouyan1/anaconda3/envs/gesture_recognition/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home//zhouyan1/PycharmProjects/BlazePalm-master/ML/handlandmarks.py", line 115, in forward b1 = self.backbone1(x) # 64x64 File "/home//zhouyan1/anaconda3/envs/gesture_recognition/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home//zhouyan1/anaconda3/envs/gesture_recognition/lib/python3.9/site-packages/torch/nn/modules/container.py", line 141, in forward input = module(input) File "/home//zhouyan1/anaconda3/envs/gesture_recognition/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1102, in _call_impl return forward_call(*input, **kwargs) File "/home//zhouyan1/anaconda3/envs/gesture_recognition/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 446, in forward return self._conv_forward(input, self.weight, self.bias) File "/home//zhouyan1/anaconda3/envs/gesture_recognition/lib/python3.9/site-packages/torch/nn/modules/conv.py", line 442, in _conv_forward return F.conv2d(input, weight, bias, self.stride, RuntimeError: expected scalar type Byte but found Float

zy1996829 avatar Apr 27 '23 08:04 zy1996829

_, _, landmarks = hl(torch.from_numpy(cropped_hand).permute((2, 0, 1)).unsqueeze(0)) you modify it like this torch.from_numpy(cropped_hand.astype(np.float32))

kylin33 avatar May 06 '23 03:05 kylin33