if not os.path.exists(COCO_MODEL_PATH): utils.download_trained_weights(COCO_MODEL_PATH)
组织参数及调用 以及传参,用一部分也可以传整个,显得很简洁
1 2 3 4 5 6 7 8 9 10 11
class InferenceConfig(coco.CocoConfig): # Set batch size to 1 since we'll be running inference on # one image at a time. Batch size = GPU_COUNT * IMAGES_PER_GPU GPU_COUNT = 1 IMAGES_PER_GPU = 1
config = InferenceConfig() config.GPU_COUNT()
model = modellib.MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)