创建环境名
conda create --name mmdetection python=3.8
激活环境
conda activate mmdetection
安装cuda、torch等
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
安装MIM
pip install -U openmim
安装mmengine
mim install mmengine
安装mmcv
mim install "mmcv>=2.0.0"
安装mmdetection
git clone https://github.com/open-mmlab/mmdetection.git
cd mmdetection
pip install -v -e .
报错:
Could not build wheels for pycocotools, which is required to install pyproject.toml-based
解决办法:
下载 C++套件生成工具,安装以下工具。
再执行
pip install -v -e .
安装成功!!!
测试:
mim download mmdet --config rtmdet_tiny_8xb32-300e_coco --dest .
python demo/image_demo.py demo/demo.jpg rtmdet_tiny_8xb32-300e_coco.py --weights rtmdet_tiny_8xb32-300e_coco_20220902_112414-78e30dcc.pth --device cpu