yqyao / SSD_Pytorch

support different SSDs and different scale test, support refineDet.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error

Sun-Fan opened this issue · comments

Hello,Do you have met the following error. Thanks a lot!
Traceback (most recent call last):
File "train.py", line 328, in
main()
File "train.py", line 310, in main
train(train_loader, net, criterion, optimizer, epoch, epoch_step, gamma, end_epoch, cfg)
File "train.py", line 98, in train
output = net(imgs)
File "/home/zhanwj/Desktop/pyTorch/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call
result = self.forward(*input, **kwargs)
File "/home/zhanwj/Desktop/pyTorch/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 124, in forward
return self.gather(outputs, self.output_device)
File "/home/zhanwj/Desktop/pyTorch/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py", line 136, in gather
return gather(outputs, output_device, dim=self.dim)
File "/home/zhanwj/Desktop/pyTorch/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py", line 67, in gather
return gather_map(outputs)
File "/home/zhanwj/Desktop/pyTorch/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py", line 62, in gather_map
return type(out)(map(gather_map, zip(*outputs)))
File "/home/zhanwj/Desktop/pyTorch/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py", line 54, in gather_map
return Gather.apply(target_device, dim, *outputs)
File "/home/zhanwj/Desktop/pyTorch/anaconda3/envs/pytorch/lib/python3.6/site-packages/torch/nn/parallel/_functions.py", line 52, in forward
assert all(map(lambda i: i.is_cuda, inputs))
AssertionError

commented

How many gpus you have ? @Sun-Fan , maybe you need to change CUDA_VISIBLE_DEVICES in train.py(line 2)

I have changed. But it doesn't work.
当修改了这些以后,可以运行。
修改的地方有:
train那里在91行的那个循环旁边加了几个改默认tensor类型的,因为dataloader里面用到一个函数没有gpu实现
/layers/module/refine_multibox_loss.py把所有if num_pos>0:都重写了, @yqyao

commented

这个是为了增加没有gt 图片训练用的,有bug,我没更新上去 @Sun-Fan

OK~

所以我修改的是没有问题是吗?还在担心这样改了以后能不能达到你的效果。 @yqyao

commented

我更新了代码 @Sun-Fan

谢谢