bug参考论文:
Python开发:OpenCV版本差异所引发的cv2.findContours()函数传参问题 - 我命倾尘 - 博客园
官方mask rcnn 地址:
Vedanuj Goswami / vqa-maskrcnn-benchmark · GitLab
https://github.com/Cadene/vqa-maskrcnn-benchmark
meetshah1995 / vqa-maskrcnn-benchmark · GitLab
我一般直接解压vqa-maskrcnn-benchmark,然后进入目录里,setup.py 运行。
注意:pytorch 版本号和torchvision 版本号,opencv-python 版本号(不能特别高)参考第一个bug链接。
直接;运行webcam.py 有段错误问题,但是具体哪里错了也未指明,可以运行他的小demo 样例
from maskrcnn_benchmark.config import cfg
from predictor import COCODemo
import cv2
import os
config_file = "/home/byd/vqa-maskrcnn-benchmark-master/configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml"
# update the config options with the config file
cfg.merge_from_file(config_file)
# manual override some options
cfg.merge_from_list(["MODEL.DEVICE", "cpu"])
coco_demo = COCODemo(
cfg,
min_image_size=800,
confidence_threshold=0.7,
)
# load image and then run prediction
image = cv2.imread("/home/byd/demo/COCO_val2014_000000218224.jpg")
predictions = coco_demo.run_on_opencv_image(image)
save_path = os.path.join("/home/byd/demo_feats/", "COCO_val2014_000000218224.jpg")
cv2.imwrite(save_path, predictions)
原图:
处理结果图: