mmdetection填坑

mmdetection安装

1. 我是在docker中使用的,直接有镜像pytorch1.2.0和cuda10,因此,按照GitHub中 open-mmlab mmdetection提供的install.md,直接跳到下载mmdetection这一步,我是直接在github上下载的压缩包,和用git应该差不多,然后cd到mmdetection文件夹,注意,后续我使用的是pip install -v -e .(python setup.py develop我用了没用,不知道为什么)

可能会遇到下载超时问题:pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read

timed out.

--default-timeout=1000 # 1000是时间 可调

解决方案: https://yq.aliyun.com/articles/619208

2. 然后训练,三个so文件找不到,参考该网址:https://blog.csdn.net/liuyingying0418/article/details/84580254

# Install
$ apt-get update
$ apt-get install apt-file
# Update apt-file
$ apt-file update
apt-get install libsm6
apt-get install libxrender1
apt-get install libgl1

 ImportError: libgthread-2.0.so.0: cannot open shared object file: No such file or directory:

apt-get install libglib2.0-0

3. 后,报错:RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [303, 256, 7, 7]], which is output 0 of IndexPutBackward, is at version 3; expected version 2 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

这个问题搞了几个小时,之前pytorch1.1.0时未出现过,查阅之后发现这是pytorch1.2.0才出现的(网上也有是0.3.0到0.4.0 variable和tensor合并出现的问题),github作者给出了修改:https://github.com/open-mmlab/mmdetection/pull/1160/commits/f64910bd4a560232bc40310f8e724ec8ce42c8e3

mmdetection填坑_第1张图片

+=是inplace操作,即应把x+=1形式改成x=x+1,我依照网上改成

roi_feats[inds] = roi_feats[inds] + roi_feats_t
仍会报错,是因为roi_feats[inds]全是零吗,希望知道的人能给我解答

ps: 代码中其他有+=的部分又没有问题,脑壳疼

 

4. 开跑了之后,存储模型时又出现了这个问题,

File "/root/anaconda3/envs/open-mmlab/lib/python3.7/site-packages/mmcv/utils/path.py", line 49, in symlink
os.symlink(src, dst, **kwargs)
OSError: [Errno 95] Operation not supported: 'epoch_1.pth' -> '/test/competition/cloth/mmdetection/work_dirs/ga_retinanet_x101_32x4d_fpn_1x/latest.pth'

具体原因我也不清楚,但可以确定的是创建软连接的问题,让latest.pth指向当前存储的模型epoch_x.pth,对我来说可有可无,所以我就把这句话注释掉了,有更好的解决方法希望万能网友告诉我。

https://github.com/open-mmlab/mmdetection/issues/1371

 

你可能感兴趣的:(pytorch,mmdetection)