Keras之Mask R-CNN:《极限挑战》第四季第2期助力高考—使用Mask R-CNN代替Photoshop抠图、颜色填充框出目标检测/图像分割/语义分割
生活随笔
收集整理的這篇文章主要介紹了
Keras之Mask R-CNN:《极限挑战》第四季第2期助力高考—使用Mask R-CNN代替Photoshop抠图、颜色填充框出目标检测/图像分割/语义分割
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Keras之Mask R-CNN:《極限挑戰(zhàn)》第四季第2期助力高考—使用Mask R-CNN代替Photoshop摳圖、顏色填充框出目標檢測/圖像分割/語義分割
導讀
沒有傘的孩子只能努力奔跑!奔跑吧,相信自己!博主提前祝莘莘學子2018年高考順利!Nothing is impossible.Just do it!
目錄
輸出結果
設計思路
核心代碼
輸出結果
設計思路
核心代碼
# -*- coding: utf-8 -*-import os import sys import argparse import numpy as np import coco import utils import model as modellib import imageio import visualizedef create_noisy_color(image, color):color_mask = np.full(shape=(image.shape[0], image.shape[1], 3),fill_value=color)noise = np.random.normal(0, 25, (image.shape[0], image.shape[1]))noise = np.repeat(np.expand_dims(noise, axis=2), repeats=3, axis=2)mask_noise = np.clip(color_mask + noise, 0., 255.)return mask_noisedef string_to_rgb_triplet(triplet):if '#' in triplet:# http://stackoverflow.com/a/4296727triplet = triplet.lstrip('#')_NUMERALS = '0123456789abcdefABCDEF'_HEXDEC = {v: int(v, 16)for v in (x + y for x in _NUMERALS for y in _NUMERALS)}return (_HEXDEC[triplet[0:2]], _HEXDEC[triplet[2:4]],_HEXDEC[triplet[4:6]])else:# https://stackoverflow.com/a/9763133triplet = make_tuple(triplet)return triplet……if __name__ == '__main__':parser = argparse.ArgumentParser(description='Person Blocker - Automatically "block" people ''in images using a neural network.')parser.add_argument('-i', '--image', help='Image file name.',required=False)parser.add_argument('-m', '--model', help='path to COCO model', default=None)parser.add_argument('-o','--objects', nargs='+',help='object(s)/object ID(s) to block. ' +'Use the -names flag to print a list of ' +'valid objects',default='person')parser.add_argument('-c','--color', nargs='?', default='(255, 255, 255)',help='color of the "block"')parser.add_argument('-l','--labeled', dest='labeled',action='store_true',help='generate labeled image instead')parser.add_argument('-n','--names', dest='names',action='store_true',help='prints class names and exits.')parser.set_defaults(labeled=False, names=False)args = parser.parse_args()if args.names:print(get_class_names())sys.exit()person_blocker(args)全部代碼和設計思路解釋每周六將公布!!!
參考文章
Mask R-CNN
最新更新說明!!!
全部代碼請移步到GitHub地址:https://github.com/matterport/Mask_RCNN
總結
以上是生活随笔為你收集整理的Keras之Mask R-CNN:《极限挑战》第四季第2期助力高考—使用Mask R-CNN代替Photoshop抠图、颜色填充框出目标检测/图像分割/语义分割的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Py之imgaug:Python库之im
- 下一篇: DL之Mask R-CNN:2018.6