Faster ILOD: Incremental learning for object detectors based on faster RCNN 2020
代码 一、Requirements:论文:https://arxiv.org/abs/2003.03901
代码:https://github.com/CanPeng123/Faster-ILOD
-
PyTorch 1.0 from a nightly release. It will not work with 1.0 nor
1.0.1. Installation instructions can be found in https://pytorch.org/get-started/locally/ -
torchvision from master
-
cocoapi
-
yacs
-
matplotlib
-
GCC >= 4.9
-
OpenCV
-
CUDA >= 9.0
# first, make sure that your conda is setup properly with the right environment # for that, check that `which conda`, `which pip` and `which python` points to the # right path. From a clean conda env, this is what you need to do conda create --name maskrcnn_benchmark -y conda activate maskrcnn_benchmark # this installs the right pip and dependencies for the fresh python conda install ipython pip # maskrcnn_benchmark and coco api dependencies pip install ninja yacs cython matplotlib tqdm opencv-python # follow PyTorch installation in https://pytorch.org/get-started/locally/ # we give the instructions for CUDA 9.0 conda install -c pytorch pytorch-nightly torchvision cudatoolkit=9.0 export INSTALL_DIR=$PWD # install pycocotools cd $INSTALL_DIR git clone https://github.com/cocodataset/cocoapi.git cd cocoapi/PythonAPI python setup.py build_ext install # install cityscapesScripts cd $INSTALL_DIR git clone https://github.com/mcordts/cityscapesScripts.git cd cityscapesScripts/ python setup.py build_ext install # install apex cd $INSTALL_DIR git clone https://github.com/NVIDIA/apex.git cd apex python setup.py install --cuda_ext --cpp_ext # install PyTorch Detection cd $INSTALL_DIR git clone https://github.com/facebookresearch/maskrcnn-benchmark.git cd maskrcnn-benchmark # the following will install the lib with # symbolic links, so that you can modify # the files if you want and won't need to # re-build it python setup.py build develop unset INSTALL_DIR # or if you are on macOS # MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build develop三、Faster-ILOD
将maskrcnn环境装好后,将Faster-ILOD 相关代码覆盖到maskrcnn相关文件夹中 ,运行 python setup.py build develop 重新编译 或者直接下载Faster-ILOD代码。
四、遇到问题 1.git clone因为网络问题下载不下来文件可以下载到本地,上传到服务器;
安装包也可以下载到本地,上传到服务器,pip install 文件路径 进行安装
pytorch版本不合适
本人cuda10.1 pytorch1.7,1
看解决方案后,将pytorch版本降为1.5 成功
CUDA 10.1 Pytorch 1.4.0 torchvision 0.5.0
3.RuntimeError: Output 0 of UnbindBackward is a view and its base or another view of its base has been modified inplace.更多解决方案可参考https://github.com/facebookresearch/maskrcnn-benchmark/issues/1236
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 此问题解决
5. error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::参考:
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
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



