kuaikuaikim/dface

ValueError: negative dimensions are not allowed

liuyang77886 opened this issue · 5 comments

我的当前环境ubuntu16;

import torch
torch.version
'1.0.1.post2'
python -V
Python 2.7.12
以下是具体错误
python test_image.py
/opt/soft/dface/dface/core/models.py:8: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
nn.init.xavier_uniform(m.weight.data)
/opt/soft/dface/dface/core/models.py:9: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_.
nn.init.constant(m.bias, 0.1)
/usr/local/lib/python2.7/dist-packages/torch/nn/functional.py:1332: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
Traceback (most recent call last):
File "test_image.py", line 21, in
bboxs, landmarks = mtcnn_detector.detect_face(img)
File "/opt/soft/dface/dface/core/detect.py", line 619, in detect_face
boxes, boxes_align = self.detect_rnet(img, boxes_align)
File "/opt/soft/dface/dface/core/detect.py", line 391, in detect_rnet
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
ValueError: negative dimensions are not allowed

全是bug,估计作者放弃这个项目了

我的当前环境ubuntu16;

import torch
torch.version
'1.0.1.post2'
python -V
Python 2.7.12
以下是具体错误
python test_image.py
/opt/soft/dface/dface/core/models.py:8: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_.
nn.init.xavier_uniform(m.weight.data)
/opt/soft/dface/dface/core/models.py:9: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_.
nn.init.constant(m.bias, 0.1)
/usr/local/lib/python2.7/dist-packages/torch/nn/functional.py:1332: UserWarning: nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.
warnings.warn("nn.functional.sigmoid is deprecated. Use torch.sigmoid instead.")
Traceback (most recent call last):
File "test_image.py", line 21, in
bboxs, landmarks = mtcnn_detector.detect_face(img)
File "/opt/soft/dface/dface/core/detect.py", line 619, in detect_face
boxes, boxes_align = self.detect_rnet(img, boxes_align)
File "/opt/soft/dface/dface/core/detect.py", line 391, in detect_rnet
tmp = np.zeros((tmph[i], tmpw[i], 3), dtype=np.uint8)
ValueError: negative dimensions are not allowed
问题出在另一个文件dface/core/image_tools.py的第20行,把return transform(image)改成return transform(image)/255就可以了。

Hi! I've encountered the same error. Did you find the way to resolve it? Thanks!

Don't change any other code from this repo and just replace row 20 in /dface/core/image_tools.py
return (transform(image) / 255).float()

It will work fine

Don't change any other code from this repo and just replace row 20 in /dface/core/image_tools.py
return (transform(image) / 255).float()

It will work fine

你是咋发现只要修改这个就有效的啊,我是将网络的参数都改变为double类型然后输入图像也是double类型然后把那个double问题跳过了,然后就遇到了如上的问题,然后我就看了他的源代码,然后输出结果,他那个tmph和tmpw是负值,然后就自闭了,您咋发现是这个问题啊