论文
Faster ILOD: Incremental learning for object detectors based on faster RCNN 2020
论文:https://arxiv.org/abs/2003.03901 代码:https://github.com/CanPeng123/Faster-ILOD
代码
一、Requirements:
二、安装 Step-by-step installation
conda create --name maskrcnn_benchmark -y
conda activate maskrcnn_benchmark
conda install ipython pip
pip install ninja yacs cython matplotlib tqdm opencv-python
conda install -c pytorch pytorch-nightly torchvision cudatoolkit=9.0
export INSTALL_DIR=$PWD
cd $INSTALL_DIR
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
python setup.py build_ext install
cd $INSTALL_DIR
git clone https://github.com/mcordts/cityscapesScripts.git
cd cityscapesScripts/
python setup.py build_ext install
cd $INSTALL_DIR
git clone https://github.com/NVIDIA/apex.git
cd apex
python setup.py install --cuda_ext --cpp_ext
cd $INSTALL_DIR
git clone https://github.com/facebookresearch/maskrcnn-benchmark.git
cd maskrcnn-benchmark
python setup.py build develop
unset INSTALL_DIR
三、Faster-ILOD
将maskrcnn环境装好后,将Faster-ILOD 相关代码覆盖到maskrcnn相关文件夹中 ,运行 python setup.py build develop 重新编译 或者直接下载Faster-ILOD代码。
四、遇到问题
1.git clone因为网络问题下载不下来
文件可以下载到本地,上传到服务器; 安装包也可以下载到本地,上传到服务器,pip install 文件路径 进行安装
2.RuntimeError: Error compiling objects for extension
pytorch版本不合适 本人cuda10.1 pytorch1.7,1 看解决方案后,将pytorch版本降为1.5 成功
CUDA 10.1
Pytorch 1.4.0
torchvision 0.5.0
更多解决方案可参考https://github.com/facebookresearch/maskrcnn-benchmark/issues/1236
3.RuntimeError: Output 0 of UnbindBackward is a view and its base or another view of its base has been modified inplace.
RuntimeError: Output 0 of UnbindBackward is a view and its base or another view of its base has been modified inplace. This view is the output of a function that returns multiple views. Such functions do not allow the output views to be modified inplace. You should replace the inplace operation by an out-of-place one.
参考: https://blog.csdn.net/Ginomica_xyx/article/details/120491859
知道问题原因是对self.bbox多次修改 ,第二次修改时,python不清楚是操作原始的self.bbox 还是修改之后的self.bbox。 知道问题所在,尝试解决问题:修改代码 将self.bbox 拷贝给一个参数 再对此参数进行操作(不可以);进行深拷贝 也不可以 。 查看相关问题,归根结底是pytorch1.7.0的bug。 将pytorch版本降为1.6.0 此问题解决
4.unable to execute ‘usr/local/cuda-10.0/bin/nvcc‘: No such file or directory
参考: linux查看和修改PATH环境变量的方法
https://blog.csdn.net/qq_41251963/article/details/110120386 https://blog.csdn.net/tailonh/article/details/120322932 https://blog.csdn.net/G_inkk/article/details/124584873
5. error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::
python setup.py build develop 重新编译是报错 RuntimeError: Error compiling objects for extension,往上查看错误原因是 /usr/include/c++/7/bits/basic_string.tcc:1067:16: error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_Rep 解决方法
参考:https://blog.csdn.net/weixin_45328592/article/details/114646355 https://blog.csdn.net/qq_29695701/article/details/118548238
sudo gedit /usr/include/c++/7/bits/basic_string.tcc
将
__p->_M_set_sharable()
改为
(*__p)._M_set_sharable()
即可。 若修改文件遇到问题: ‘readonly’ option is set (add ! to override) 当前用户没有权限,先sudo -i切换到root权限再进行修改 直接使用sudo vim 打开文件进行修改
参考 https://blog.csdn.net/cheng_feng_xiao_zhan/article/details/53391474
RuntimeError: Error compiling objects for extension 还有可能是下面的原因:
-
pytorch版本不匹配 -
cuda多版本切换的问题
解决:报错的路径里面多了一个冒号,说明是环境变量的设置有问题
sudo vim ~/.bashrc export CUDA_HOME=$CUDA_HOME:/usr/local/cuda 改为 export CUDA_HOME=/usr/local/cuda
source ~/.bashrc
参考: https://blog.csdn.net/loovelj/article/details/110490986 https://www.codeleading.com/article/95735054818/ https://blog.csdn.net/zt1091574181/article/details/113611468
|