Swin-Transformer-Object-Detection(mmdetection) 安裝
conda create -n stod -y python=3.8
conda activate stod
conda install pytorch=1.6.0 torchvision cudatoolkit=10.2 -c pytorch -y (可以替換自己需要的版本)
# mmcv安装
cd ~/software/
rm -rf mmcv
git clone https://github.com/open-mmlab/mmcv.git
cd mmcv
MMCV_WITH_OPS=1 pip install -e .
or
pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/{cu_version}/{torch_version}/index.html
eg: pip install mmcv-full=1.4.6 -f https://download.openmmlab.com/mmcv/dist/cu113/torch1.10.0/index.html
實際版本參考網站:https://mmcv.readthedocs.io/en/latest/get_started/installation.html
# 安装apex
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" ./
可能會安裝失敗
可以試試:python setup.py install
# mmdetection安装
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -r requirements/build.txt
pip install -r requirements.txt
pip install -v -e .
or
pip install mmdet==(version)
注意:mmcv與mmdet的版本必須要搭配,版本參考:https://mmdetection.readthedocs.io/en/latest/get_started.html
cd /home/zengxh/workspace/Swin-Transformer-Object-Detection
pip install -r requirements.txt
or
pip install -v -e .
————————————————
測試環境:
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
測試成功的環境:
mmcv-full: 1.3.18
mmdet: 2.11.0
pytorch: 1.6.0
cuda:10.2
or
gpu: 3060ti
mmcv-full: 1.4.6
mmdet: 2.22.0
pytorch: 1.8
cuda: 11.3
中間遇到提:
ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
原因:numpy版本太舊
pip install --upgrade numpy 解決
留言
張貼留言