源码地址:Swin-Transformer-Object-Detection
主要的package版本如下
------------------ ----------- ------------------------------------------------------------------
apex 0.1
mmcv 1.3.5
mmcv-full 1.4.0
mmdet 2.11.0
openmim 0.3.1
torch 1.8.1+cu102
torchaudio 0.8.1
torchvision 0.9.1+cu102
安装命令如下:
pip install torch==1.8.1+cu102torchvision==0.9.1+cu102 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
注:每个版本都需要匹配,安装的过程不匹配会报错提示
pip install -r requirements/build.txt
pip install -v -e .
如果下载比较慢,可以使用镜像源单个下载,如:
pip install matplotlib==3.5.3 -i https://mirrors.aliyun.com/pypi/simple/
pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu102/torch1.8.1/index.html
报错:
× Encountered error while trying to install package.
╰─> mmcv-full
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
解决方法:
pip install -U openmim
mim install mmcv-full
安装最新版本,这时会提示你现在安装的mmdetection和安装的mmcv不符,而且会给出符合你的mmdetection版本的mmcv版本的范围。我安装的mmdetection版本是2.25.0,提示符合的mmcv版本是1.4.4以上,1.6.0以下。
把原来的mmcv-full卸载:
pip uninstall mmcv-full
在安装一个在范围以内的版本:
mim install mmcv-full==1.4.0
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir ./
train=dict(
type=dataset_type,
ann_file=data_root + 'annotations/instances_train2017.json',
img_prefix=data_root + 'train2017/',
pipeline=train_pipeline),
val=dict(
type=dataset_type,
ann_file=data_root + 'annotations/instances_val2017.json',
img_prefix=data_root + 'val2017/',
pipeline=test_pipeline),
test=dict(
type=dataset_type,
ann_file=data_root + 'annotations/instances_test2017.json',
img_prefix=data_root + 'test2017/',
pipeline=test_pipeline))
python tools/train.py configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py