-
1.mmcv-full安装
同MMdetection环境配置一样,可参考我上一篇文章
-
2.下载仓库
下载仓库时,将git clone的地址换成Swin-Transformer的仓库地址
git clone https://github.com/SwinTransformer/Swin-Transformer-Object-Detection.git
cd Swin-Transformer-Object-Detection
-
3.重新安装mmcv-full
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
MMCV_WITH_OPS=1 pip install -e . # package mmcv-full will be installed after this step
cd ..
注意-e 后面一点不要漏了
-
4.安装依赖
pip install -r requirements/build.txt
pip install -v -e . # or "python setup.py develop"
-
5.apex(混合精度训练)optional
如果安装,输入
git clone https://github.com/NVIDIA/apex
cd apex
pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
则需要在配置文件末尾,将下述代码注释
# do not use mmdet version fp16
fp16 = None
optimizer_config = dict(
type="DistOptimizerHook",
update_interval=1,
grad_clip=None,
coalesce=True,
bucket_size_mb=-1,
use_fp16=True,
)
并将
runner = dict(type='EpochBasedRunnerAmp',max_epochs=36)
改成
runner = dict(type='EpochBasedRunner',max_epochs=36)
-
可行搭配
-
python = 3.7 cuda = 10.2 pytorch = 1.8.0 python = 3.7 cuda = 11.1 pytorch = 1.7.0