SSD-pytorch训练及检测遇到的问题

这两天下载了Github上一个关于SSD目标检测的项目,训练和测试过程中遇到了一些问题,在此记录一下:

项目地址: https://github.com/amdegroot/ssd.pytorch

1 关于pip install

在使用 pip install xxx 时,有时可能会出现 ‘Could not fetch URL
https://pypi.python.org’的问题。

解决方法:输入 pip install xxx -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

其中 xxx 就是你想要安装的库,如numpy。

2 GPU和CPU

项目源代码写的是GPU版本,用到了CUDA。如果你没有GPU,则需要将代码转化为CPU版本。这大致需要两个步骤:

(1)将所有的torch.load(xxx),改为torch.load(xxx, map_location=‘cpu’)

(2)去除掉所有张量后面的.cuda(),类似于下图,注释掉的是源代码,添加了后面不加.cuda()的代码,ctrl+F寻找cuda即可。

![在这里插入图片描述](https://img-blog.csdnimg.cn/20200209125721823.png在这里插入图片描述

3 索引问题

IndexError: The shape of the mask [32, 8732] at index 0does not match
the shape of the index

评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值