SSD.Pytorch运行问题汇总

地址

https://github.com/amdegroot/ssd.pytorch

环境配置

传了anaconda配置,主要是自己用。(直接去上面地址中的github地址配置就行)
https://download.csdn.net/download/Doraemon_Zzn/12614296

conda env create -f xxx.yaml

train.py

1.FileNotFoundError: [Errno 2] No such file or directory

修改路径指向自己的数据集:
针对coco数据集,修改data/coco.py第11行
COCO_ROOT = osp.join(HOME, ‘data/coco/’)

针对voc数据集,修改data/voc0712.py第28行
VOC_ROOT = osp.join(HOME, “data/VOCdevkit/”)

我改成绝对路径才成功

用的是VOC数据集,形式如下:

  • VOCdevkit
    • VOC2007
    • VOC2012

2.RuntimeError: randperm is only implemented for CPU

torch/utils/data/sampler.py 第51行处内容如下

def _iter_(self)
    cpu = torch.device('cpu')
    return iter(torch.randperm(len(self.data_source),device = cpu).tolist())

3.images, targets = next(batch_iterator)

在这里插入图片描述

try:
    images, targets = next(batch_iterator)
except StopIteration:
    bath_iterator = iter(data_loader)
    images, targets = next(bath_iterator)

4.RuntimeError: The shape of the mask [32, 8732] at index 0 does not match the shape of the indexed tensor [279424, 1] at index 0

layers/modules/multibox_loss.py 第97、98行调换

loss_c = loss_c.view(num, -1)
loss_c[pos] = 0  # filter out pos boxes for now

第114行将 N = num_pos.data.sum() 改为

N = num_pos.data.sum().double()
loss_l = loss_l.double()
loss_c = loss_c.double()

5.RuntimeError: DataLoader worker is killed by signal: Killed

num_workers=0

在这里插入图片描述

eval.py

在这里插入图片描述
自己训练15000iter的结果。
在这里插入图片描述

参考

https://blog.csdn.net/lianggyu/article/details/100076153
https://github.com/pytorch/pytorch/issues/8976
https://zhuanlan.zhihu.com/p/92154612

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值