目标检测框架mmdetection框架的安装与测试
最近利用Conda终于成功安装了mmdetection,说实话,非conda的还真的不好装,特别在.complie的时候,即使成功,总是会出现各种问题,直到conda安装后,才明白之前的问题关键所在,即必须numpy为1.16.2版本,且pytorch需要为1.0版本。之前从release版本中下载了0.4.1的版本,还是有问题。1、框架介绍这个框架还是非常清晰的,整个代码从骨架,模型,B...
·
最近利用Conda终于成功安装了mmdetection,说实话,非conda的还真的不好装,特别在.complie的时候,即使成功,总是会出现各种问题,直到conda安装后,才明白之前的问题关键所在,即必须numpy为1.16.2版本,且pytorch需要为1.0版本。之前从release版本中下载了0.4.1的版本,还是有问题。
1、框架介绍
这个框架还是非常清晰的,整个代码从骨架,模型,BBOX处理,推断等都有专门的项目文件夹。而且提供了当前许多主流的目标检测模型的实现。
2、安装
建议使用conda的方式来安装,用代码重新编译的方式会出现一些BUG。在conda环境下有一些支持的LIB容易有,而用传统的PYTHON包的方式,在compile中虽然可以成功,但使用上会出现问题。
cd mmdetection pip install cython # or "conda install cython" if you prefer conda ./compile.sh
python(3) setup.py install
安装成果如图所示。
2、实验测试:
撰写几行代码,即可完成框架的测试:
import mmcv
from mmcv.runner import load_checkpoint
from mmdet.models import build_detector
from mmdet.apis import inference_detector, show_result
cfg = mmcv.Config.fromfile('configs/faster_rcnn_r50_fpn_1x.py')
cfg.model.pretrained = None
# construct the model and load checkpoint
model = build_detector(cfg.model, test_cfg=cfg.test_cfg)
_ = load_checkpoint(model, 'https://s3.ap-northeast-2.amazonaws.com/open-mmlab/mmdetection/models/faster_rcnn_r50_fpn_1x_20181010-3d1b3351.pth')
# test a single image
img = mmcv.imread('test.jpg')
result = inference_detector(model, img, cfg)
show_result(img, result)
将其中的图片替换成tensorflow object detection的测试图片,其检测结果如下所示(faster-rcnn)结果。
从百度上随便找了张图片进行测试
该框架速度的确比较快。还是很不错的。
更多推荐
所有评论(0)