dface icon indicating copy to clipboard operation
dface copied to clipboard

RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight'

Open andkobe opened this issue 5 years ago • 2 comments

你好,我在跑test_image.py时遇到这个问题 RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight', 打印如下: Traceback (most recent call last): File "E:/Code/MachineLearning/DFace-master/test_image.py", line 18, in bboxs, landmarks = mtcnn_detector.detect_face(img) File "E:\Code\MachineLearning\DFace-master\dface\core\detect.py", line 610, in detect_face boxes, boxes_align = self.detect_pnet(img) File "E:\Code\MachineLearning\DFace-master\dface\core\detect.py", line 271, in detect_pnet cls_map, reg = self.pnet_detector(feed_imgs) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 547, in call result = self.forward(*input, **kwargs) File "E:\Code\MachineLearning\DFace-master\dface\core\models.py", line 97, in forward x = self.pre_layer(x) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 547, in call result = self.forward(*input, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\container.py", line 92, in forward input = module(input) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\module.py", line 547, in call result = self.forward(*input, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 343, in forward return self.conv2d_forward(input, self.weight) File "D:\ProgramData\Anaconda3\lib\site-packages\torch\nn\modules\conv.py", line 340, in conv2d_forward self.padding, self.dilation, self.groups) RuntimeError: Expected object of scalar type Double but got scalar type Float for argument #2 'weight'

Process finished with exit code 1

有朋友遇到类似问题么?感谢!

andkobe avatar Dec 19 '19 13:12 andkobe

将./dface/core/image_tools.py文件中第20行改为: return (transform(image) / 255).float()

SimonFFL avatar Apr 13 '20 09:04 SimonFFL

这是来自QQ邮箱的假期自动回复邮件。你好,我最近正在休假中,无法亲自回复你的邮件。我将在假期结束后,尽快给你回复。

kuaikuaikim avatar Nov 23 '23 07:11 kuaikuaikim