对./Mask_RCNN-master/samples/balloon/ballon.py改动,新增一个函数:
def detect_and_batch_splash(model, image_path=None, video_path=None):
assert image_path
if image_path:
# Run model detection and generate the color splash effect
print("Running on {}".format(args.image))
# Read image
for img in sorted(list(set([file.split('.')[0] for file in os.listdir(image_path)]))):
print(img)
image = skimage.io.imread(os.path.join(image_path,img+'.jpg'))
# Detect objects
r = model.detect([image], verbose=1)[0]
# Color splash
visualize.display_images_instances(img+'.jpg',image, r['rois'], r['masks'], r['class_ids'],r['scores'],['BG','single'],show_mask=True, show_bbox=False)
这样就会以目标轮廓边缘的标记形式标记出目标物体。
如果希望以bbox的方式标出测试图片中的物体,将show_mask=False,show_bbox=True。
同时需要修改./Mask_RCNN-master/mrcnn/visualize.py中的display_images_instances函数:
def display_images_instances(image_name,image, boxes, masks, class_ids, class_names,
scores=None, title="",
figsize=(16

最低0.47元/天 解锁文章
6390

被折叠的 条评论
为什么被折叠?



