计算机视觉之目标检测库安装记录

 detectron2开源项目位置:

https://github.com/facebookresearch/detectron2

detectron2安装文档:

Installation — detectron2 0.6 documentation

测试demo

python demo.py --config-file ../configs/COCO-InstanceSegmentation/mask_rcnn_R_50_FPN_3x.yaml --input ../test_img/test3.png --opts MODEL.WEIGHTS ../mask_rcnn/model_final_a54504.pkl

MMdetection 项目位置:

https://github.com/open-mmlab/mmdetection

MMdetection安装文档:

依赖 — MMDetection 2.18.0 文档

测试demo

下载模型并放到checkpoint文件夹下http://download.openmmlab.com/mmdetection/v2.0/faster_rcnn/faster_rcnn_r50_fpn_1x_coco/faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth

在mmdetection目录下创建demo.py ,执行即可看到渲染效果图

from mmdet.apis import init_detector, inference_detector,async_inference_detector, show_result_pyplot
import time

config_file = 'configs/faster_rcnn/faster_rcnn_r50_fpn_1x_coco.py'
# 从 model zoo 下载 checkpoint 并放在 `checkpoints/` 文件下
# 网址为: http://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'
# 初始化检测器
model = init_detector(config_file, checkpoint_file, device=device)
# 推理演示图像
img = 'demo/demo.jpg'

start_time = time.time()
result = inference_detector(model, img)
print("inference cost time:{}s".format(time.time()-start_time))
# print(result)
show_result_pyplot(model, img, result, score_thr=0.3)

版权声明:本文为CSDN博主「blog_1103」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42393859/article/details/121145478

blog_1103

我还没有学会写个人说明!

暂无评论

发表评论

相关推荐

从0开始实现目标检测——实践篇

根据上一篇《从0开始实现目标检测——原理篇》的讲述,我们选择了YOLOv3作为模型,那么本篇文章将继续接着上篇的内容,自己动手基于YOLOv3实现模型训练和mAP的计算。 在自己动手的这个过程中&#xf

YOLO-V3-SPP详细解析

YOLO-V3-SPP 继前两篇简单的YOLO博文 YOLO-V1 论文理解《You Only Look Once: Unified, Real-Time Object Detection》YOLO-V2论文理解《YOLO9000: Bet

目标检测部署(卡牌识别)

最近在折腾yolov5,训练了一个识别纸牌的模型,最后使用onnxruntime进行部署,感兴趣的可以上github上clone下来玩玩,模型的权重文件上传到了百度网盘,链接