ubuntu–18.04
GPU–2080ti
cuda–11.0
torch–1.7.0
mmcv–1.4.0
mmdetection–2.24.0
1创建环境
conda create -n swin python=3.8
conda activate swin
2安装pytorch
地址:https://pytorch.org/get-started/previous-versions/
换源阿里云 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com(清华源找不到)
pip install torch==1.7.0+cu110 torchvision==0.8.0+cu110 torchaudio==0.7.0 -f https://download.pytorch.org/whl/torch_stable.html -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
3安装其他依赖包
清华源
pip install cython matplotlib opencv-python termcolor==1.1.0 yacs==0.1.8 -i https://pypi.tuna.tsinghua.edu.cn/simple
4安装mmcv-full
清华源
pip install mmcv-full==1.4.0 -f https://download.openmmlab.com/mmcv/dist/cu110/torch1.7.0/index.html -i https://pypi.tuna.tsinghua.edu.cn/simple
5安装mmdetection
https://github.com/open-mmlab/mmdetection
下载2.24.0.zip放到swin环境根目录里名为mmdetection
cd mmdetection
pip install -r requirements/build.txt
pip install -v -e.
6安装apex
https://github.com/NVIDIA/apex
下载后放到swin环境根目录里名为apex
cd apex
pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
python setup.py install
or pip install -v --no-cache-dir ./
成功
Processing dependencies for apex==0.1
Finished processing dependencies for apex==0.1
测试demo
下载demo权重:( 放到项目的根目录里)https://github.com/SwinTransformer/storage/releases/download/v1.0.2/mask_rcnn_swin_tiny_patch4_window7.pth
运行demo
python demo/image_demo.py demo/demo.jpg configs/swin/mask_rcnn_swin_tiny_patch4_window7_mstrain_480-800_adamw_3x_coco.py mask_rcnn_swin_tiny_patch4_window7.pth
报错:
TypeError: init() got an unexpected keyword argument ‘embed_dim’
解决(终端输入):export PYTHONPATH=/home/nwpu/PycharmProjects/Swin-Transformer-Object-Detection-master