程序1-----https://github.com/csuhan/s2anet
bug1:ImportError: cannot import name 'get_dist_info' from 'mmcv.runner.utils' (/home/zyt/anaconda3/envs/s2anet/lib/python3.7/site-packages/mmcv/runner/utils.py)
原因: 可能是版本更新问题, mmcv.runner.utils下面只定义了get_host_info():确实没有定义get_dist_info, 回溯错误的上一行:from .sampler import DistributedGroupSampler, DistributedSampler, GroupSampler 原来是在sampler这个包中导入的错误。
解决: 将build_loader.py sampler.py中的from mmcv.runner.utils import get_dist_info 注释掉.
bug2:pip安装时出现THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE
原因:由于网速等原因,需要重复使用命令:【pip install XXXXX】安装XXXXX,此时看你会报错:
THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE
解决: 使用命令【pip install --upgrade XXXXX】即可解决。
bug3 :cv2.error: OpenCV(3.4.2) /tmp/build/80754af9/opencv-suite_1535558553474/work/modules/highgui/src/window.cpp:615: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function 'cvNamedWindow'
原因: 安装opencv时编译配置出现了问题
解决: 使用命令
conda remove opencv
conda install -c menpo opencv
pip install --upgrade pip
pip install opencv-contrib-python
具体环境配置过程:
a. Create a conda virtual environment and activate it.
conda create -n s2anet-d2det python=3.6 -y
conda activate s2anet-d2det
b. Install PyTorch stable or nightly and torchvision following the official instructions, e.g.,
conda install pytorch=1.3 torchvision cudatoolkit=10.0 -c pytorch
pip3 install torchstat
pip install -v -e .
pip install pycocotools
pip install summary
pip install PyWavelets
pip install torchsummary
d. Install s2anet
cd s2anet
pip install -r requirements.txt
python setup.py develop
# or "pip install -v -e ."
e. Install DOTA_devkit
sudo apt-get install swig
cd DOTA_devkit/polyiou
swig -c++ -python csrc/polyiou.i
python setup.py build_ext --inplace