【BUG】SSG-master的认识和各种问题解决

一、文档认识:

1、工程文件

https://github.com/lufficc/SSD

整个工程文件:在这里插入图片描述
原始文件

2、数据集和标签文件

我们需要认识下整个项目,我们以voc2007数据集为例子,这儿贴出数据集下载地方:
VOC数据集下载地址如下,里面已经包括了训练集、测试集、验证集(与测试集一样),无需再次划分:
链接: https://pan.baidu.com/s/1-1Ej6dayrx3g0iAA88uY5A
提取码: ph32
下载后直接放到根目录下,新建一个datasets,如图所示
在这里插入图片描述

3、yaml文件

在:configs/vgg_ssd300_voc0712.yaml
在这里插入图片描述
切记不要漏掉TRAIN里面的逗号,BATCH_SIZE根据自己设备调节,NUM_CLASSES这个要在自己标注的种类上加一,也就是加上背景

4、配置文件

在ssd/config/defaults.py和ssd/config/path_catlog.py
defaults.py中:
_C.DATA_LOADER.NUM_WORKERS = 0
path_catlog.py中:
如果向我一样命名数据集就不用更改,主要是更改数据集的位置

5、模型文件

这个主要是以vgg为主干网络,这个它会自动生成在这个文件下,运行train.py文件会有,不然.torch文件夹不会生成,你也可以自己新建然后自己找一个vgg的模型。
在这里插入图片描述

二、问题

有了认识就来解决问题:

问题1:line 88, in main

cfg.merge_from_file(args.config_file)

File “D:\software\anaconda\anaconda_setting\lib\site-packages\yacs\config.py”, line 211, in merge_from_file
with open(cfg_filename, “r”) as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘’
找不到路径,手动添加即可:

parser.add_argument(
        "--config-file",
        default="configs/vgg_ssd300_voc0712.yaml",
        metavar="FILE",
        help="path to config file",
        type=str,
    )

问题2:报错 UserWarning: No NMS is available. Please upgrade torchvision to 0.3.0+的解决办法

参考博客:https://www.cnblogs.com/herd/p/16090042.html

找到文件:ssd/utils/nms.py,注释即可在这里插入图片描述

问题3:File “E:\code\SSD-master\train.py”, line 89, in main

cfg.merge_from_file(args.config_file)

File “D:\software\anaconda\anaconda_setting\lib\site-packages\yacs\config.py”, line 212, in merge_from_file
cfg = self.load_cfg(f)
File “D:\software\anaconda\anaconda_setting\lib\site-packages\yacs\config.py”, line 363, in load_cfg
return cls._load_cfg_from_file(cfg_file_obj_or_str)
File “D:\software\anaconda\anaconda_setting\lib\site-packages\yacs\config.py”, line 372, in _load_cfg_from_file
return cls._load_cfg_from_yaml_str(file_obj.read())
UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xad in position 13: illegal multibyte sequence
这个项目使用yacs包,我看了vgg_ssd300_voc0712.yaml文件是utf-8的格式,但是就是读不出来,然后我下载的是这个版本,
报错,卸载重找没用
在这里插入图片描述
如图,自己写个函数
在这里插入图片描述

问题4:AttributeError: module ‘numpy‘ has no attribute ‘bool‘.

参考博客:https://blog.csdn.net/weixin_44716485/article/details/130554982

问题5:RuntimeError: Trying to resize storage that is not resizable

参考文献:https://blog.csdn.net/qq_38308388/article/details/134017869

将ssd/config/defaults.py文件中如图修改为0
在这里插入图片描述
然后不出意外的话应该可以运行,整体的环境是:

print(torch.__version__)
1.12.1+cu113
print(torch.cuda_version)
11.3
print(torch.backends.cudnn.version())
8302

问题6:raise RuntimeError(‘Error(s) in loading state_dict for {}:\n\t{}’.format(

RuntimeError: Error(s) in loading state_dict for SSDDetector:
这个问题出自将自己的数据集和标签进行训练时候,只需要将outputs文件夹里面已经训练好的模型删除即可
参考文献:

https://blog.51cto.com/u_16213592/11777787
https://zhuanlan.zhihu.com/p/98059235
https://zhuanlan.zhihu.com/p/62725380
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值