kuaikuaikim / dface

Deep learning face detection and recognition, implemented by pytorch. (pytorch实现的人脸检测和人脸识别)
http://dface.tech
Apache License 2.0
1.26k stars 350 forks source link

ValueError: negative dimensions are not allowed #30

Open liuyang77886 opened 5 years ago

liuyang77886 commented 5 years ago

我的当前环境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.xavieruniform. nn.init.xavieruniform(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 commented 5 years ago

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

Llq201809 commented 5 years ago

我的当前环境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.xavieruniform. nn.init.xavieruniform(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 commented 4 years ago

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

phamthephuc commented 4 years ago

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 commented 3 years ago

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