Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: negative dimensions are not allowed #30

Open
liuyang77886 opened this issue Mar 28, 2019 · 5 comments
Open

ValueError: negative dimensions are not allowed #30

liuyang77886 opened this issue Mar 28, 2019 · 5 comments

Comments

@liuyang77886
Copy link

我的当前环境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

@EternalSaga
Copy link

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

@Llq201809
Copy link

我的当前环境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就可以了。

@owoshch
Copy link

owoshch commented Sep 17, 2020

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

@phamthephuc
Copy link

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

@2460707925
Copy link

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是负值,然后就自闭了,您咋发现是这个问题啊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants