- https://github.com/open-mmlab/mmdetection/blob/master/docs/get_started.md
-
注意事项
-
在安装MMDetection之前需要先将环境中的MMCV卸载掉
- 注意:如果你安装了mmcv,你需要先运行 pip uninstall mmcv将其卸载掉。如果 mmcv 和 mmcv-full 都安装了,就会有ModuleNotFoundError.
-
MMCV的版本需要和PyTorch以及cuda的版本匹配才行
- https://github.com/open-mmlab/mmcv#installation
-
不用安装最新版的MMCV
- 最新版的MMCV,MMDetection不支持
-
在安装MMDetection之前需要先将环境中的MMCV卸载掉
-
安装要求
- Linux or macOS (Windows is in experimental support)
- Python 3.6+
- PyTorch 1.3+
- CUDA 9.2+ (If you build PyTorch from source, CUDA 9.0 is also compatible)
- GCC 5+
- MMCV
- MMDetection和MMCV对应的版本要求如下
-
- MMDetection_version MMCV_version master mmcv-full>=1.3.14, <1.4.0 2.18.0 mmcv-full>=1.3.14, <1.4.0 2.17.0 mmcv-full>=1.3.14, <1.4.0 2.16.0 mmcv-full>=1.3.8, <1.4.0 2.15.1 mmcv-full>=1.3.8, <1.4.0 2.15.0 mmcv-full>=1.3.8, <1.4.0 2.14.0 mmcv-full>=1.3.8, <1.4.0 2.13.0 mmcv-full>=1.3.3, <1.4.0 2.12.0 mmcv-full>=1.3.3, <1.4.0 2.11.0 mmcv-full>=1.2.4, <1.4.0 2.10.0 mmcv-full>=1.2.4, <1.4.0 2.9.0 mmcv-full>=1.2.4, <1.4.0 2.8.0 mmcv-full>=1.2.4, <1.4.0 2.7.0 mmcv-full>=1.1.5, <1.4.0 2.6.0 mmcv-full>=1.1.5, <1.4.0 2.5.0 mmcv-full>=1.1.5, <1.4.0 2.4.0 mmcv-full>=1.1.1, <1.4.0 2.3.0 mmcv-full==1.0.5 2.3.0rc0 mmcv-full>=1.0.2 2.2.1 mmcv==0.6.2 2.2.0 mmcv==0.6.2 2.1.0 mmcv>=0.5.9, =0.5.1,
-
准备环境
- conda create -n MMDetection python=3.7 -y
- conda activate MMDetection
-
安装PyTorch
- MMDetection 是以PyTorch为底层框架的,所以需要首先安装PyTorch才行
- 这个自己直接就是安装的最新的稳定版,我感觉应该会有很多特性支持
- conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch
- 如果conda走不通的话,可以考虑使用pip安装
- pip install torch==1.8.2+cu111 torchvision==0.9.2+cu111 torchaudio===0.8.2 -f https://download.pytorch.org/whl/lts/1.8/torch_lts.html
-
安装MMCV
- Windows下源码安装
- 参考这篇教程
-
https://zhuanlan.zhihu.com/p/427622928
-
安装MMDetection
- 一行代码的事
- pip install mmdet
-
-
安装额外的依赖项
- 这个其实安不安装,对于一般问题而言区别不大,不过最好还是安装上去,省心
- # for instaboost pip install instaboostfast # for panoptic segmentation pip install git+https://github.com/cocodataset/panopticapi.git # for LVIS dataset pip install git+https://github.com/lvis-dataset/lvis-api.git # for albumentations pip install albumentations>=0.3.2 --no-binary imgaug,albumentations
-
验证安装
- from mmdet.apis import init_detector, inference_detector config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py' # download the checkpoint from model zoo and put it in `checkpoints/` # url: https://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth checkpoint_file = 'checkpoints/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth' device = 'cuda:0' # init a detector model = init_detector(config_file, checkpoint_file, device=device) # inference the demo image inference_detector(model, 'demo/demo.jpg')
- 若是运行出下面的界面就可以了
-
-
报错
-
ModuleNotFoundError: No module named 'mmcv._ext'
- ModuleNotFoundError: No module named ‘mmcv._ext‘_一千零一夜的博客-CSDN博客
-
使用whl安装
- 不过Win平台的模块比较少,而且Python都是1.6版本的
-
https://download.openmmlab.com/mmcv/dist/index.html
-
-
不过需要注意的是,找到对应的平台版本,否则会报下面的问题
- 这个就是自己安装了Linux平台的代码报的错误
-
- 简单来说就是MMCV没有安装好,按照上面的教程步骤再走一遍吧。
-
ModuleNotFoundError: No module named 'mmcv._ext'
-
Windows下面安装MMDetection图文教程
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- open-mmlab安装环境版本 cuda = 10.1 python = 3.7.10 pytorch = 1....
- https://github.com/open-mmlab/mmcv 简介 是OpenMMLab家自己开发的...
- 1.1 mmdetction 安装 1.1.1 系统环境需求 参考 mmdetection 官方文档 https:...
- 1 mmdetection 安装及测试 1.1可以通过docker直接安装 在docker hub上搜索mmdet...
- 今天青石的票圈出镜率最高的,莫过于张艺谋的新片终于定档了。 一张满溢着水墨风的海报一次次的出现在票圈里,也就是老谋...



