jianzhnie / pyramidbox_pytorch Goto Github PK
View Code? Open in Web Editor NEWpytorch实现的Pyramidbox 人脸检测模型, 对原来代码的部分模块进行了修改,更简洁高效
pytorch实现的Pyramidbox 人脸检测模型, 对原来代码的部分模块进行了修改,更简洁高效
你好,我成功的训练出了模型。但是在运行demo.py的时候出现了一个bug。
Traceback (most recent call last):
File "demo.py", line 117, in
detect(net, path, args.thresh)
File "demo.py", line 73, in detect
y = net(x)
File "/home/huyutao/anaconda3/envs/pytorch_gpu/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/huyutao/anaconda3/envs/pytorch_gpu/lib/python3.7/site-packages/torch/nn/parallel/data_parallel.py", line 150, in forward
return self.module(*inputs[0], **kwargs[0])
File "/home/huyutao/anaconda3/envs/pytorch_gpu/lib/python3.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/huyutao/face_mask_detect/pyramidbox_pytorch/models/pyramidbox.py", line 262, in forward
self.softmax(face_mbox_conf))
TypeError: forward() missing 1 required positional argument: 'prior_data'
我查看了下源代码,是在pyramidbox.py中的261行。output = self.detect(face_mbox_loc, self.softmax(face_mbox_conf))少传了一个参数
Detect class貌似需要3个参数:loc_data, conf_data, prior_data;
请问下,prior_data这个参数如何传递?
如果我的理解有误,也请告知解决这个bug的方法。。。谢谢。
the flowing code is in your 'models.pyramidbox.py':
if not self.is_infer:
output = (face_mbox_loc, face_mbox_conf,
head_mbox_loc, head_mbox_conf)
else:
output = self.detect(face_mbox_loc, self.softmax(face_mbox_conf))
but the function self.detect()
needs three parameters in your script 'layers.functions.detection.py'
class Detect(Function):
def __init__(self, cfg):
...
def forward(self, loc_data, conf_data, prior_data):
so, when i run 'demo.py', the flowing error reported:
TypeError: forward() missing 1 required positional argument: 'prior_data'
from pyramidbox import build_net
to
from models.pyramidbox import build_net
/home/lyl/anaconda3/envs/py1.3/bin/python /home/lyl/000_Code/pyramidbox_1.3/demo.py
Traceback (most recent call last):
File "/home/lyl/000_Code/pyramidbox_1.3/demo.py", line 113, in
detect(net, path, args.thresh)
File "/home/lyl/000_Code/pyramidbox_1.3/demo.py", line 73, in detect
y = net(x)
File "/home/lyl/anaconda3/envs/py1.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, **kwargs)
File "/home/lyl/000_Code/pyramidbox_1.3/models/pyramidbox.py", line 173, in forward
ssh_conv3_norm = self.cpm0
File "/home/lyl/anaconda3/envs/py1.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, **kwargs)
File "/home/lyl/000_Code/pyramidbox_1.3/models/pyramidbox.py", line 56, in forward
out_residual = self.branch1(x)
File "/home/lyl/anaconda3/envs/py1.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, **kwargs)
File "/home/lyl/000_Code/pyramidbox_1.3/models/pyramidbox.py", line 35, in forward
return self.bn1(x)
File "/home/lyl/anaconda3/envs/py1.3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 541, in call
result = self.forward(*input, **kwargs)
File "/home/lyl/anaconda3/envs/py1.3/lib/python3.6/site-packages/torch/nn/modules/batchnorm.py", line 81, in forward
exponential_average_factor, self.eps)
File "/home/lyl/anaconda3/envs/py1.3/lib/python3.6/site-packages/torch/nn/functional.py", line 1670, in batch_norm
training, momentum, eps, torch.backends.cudnn.enabled
RuntimeError: CUDA out of memory. Tried to allocate 322.00 MiB (GPU 0; 3.95 GiB total capacity; 2.90 GiB already allocated; 88.56 MiB free; 39.48 MiB cached)
Process finished with exit code 1
criterion1(out, face_targets)
but criterion1 = MultiBoxLoss(cfg, args.cuda)
def forward(self, predictions, priors, targets):
"""Multibox Loss
need 3 args
TypeError: forward() missing 1 required positional argument: 'targets'
Hello, I have the following error when running the train.py file:
runtimeerror: expected a 'CUDA' device type for generator but found 'CPU'
How can I solve this problem?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.