config = InferenceConfig() config.display() ##### result_path = DEFAULT_IMAGE_DIR + '/result' cropped_path = DEFAULT_IMAGE_DIR + '/cropped' if not os.path.isdir(result_path): os.mkdir(DEFAULT_IMAGE_DIR + '/result') os.mkdir(DEFAULT_IMAGE_DIR + '/cropped') ################# LOAD MODELS ####################### #### MASK-R-CNN mrcnn_model = modellib.MaskRCNN(mode="inference", config=config, model_dir=DEFAULT_LOGS_DIR) weights_path = DEFAULT_MRCNN_MODEL_DIR mrcnn_model.load_weights(weights_path, by_name=True) ##### EFFICIENTNET efficient_net = EfficientNetB0(weights='imagenet', input_shape=(32, 32, 3), include_top=False, pooling='max') eff_model = Sequential() eff_model.add(efficient_net) eff_model.add(Dense(units=120, activation='relu')) eff_model.add(Dense(units=120, activation='relu'))
brush_result_path = DEFAULT_IMAGE_DIR + '/result_brush' crack_result_path = DEFAULT_IMAGE_DIR + '/result_crack' cropped_path = DEFAULT_IMAGE_DIR + '/cropped' if not os.path.isdir(brush_result_path): os.mkdir(DEFAULT_IMAGE_DIR + '/result_brush') if not os.path.isdir(crack_result_path): os.mkdir(DEFAULT_IMAGE_DIR + '/result_crack') if not os.path.isdir(cropped_path): os.mkdir(DEFAULT_IMAGE_DIR + '/cropped') brush_model = modellib.MaskRCNN(mode="inference", config=brush_config, model_dir=DEFAULT_LOGS_DIR) brush_weights_path = DEFAULT_BRUSH_DIR #### MASK-R-CNN brush with tf.device('/gpu:0'): brush_model.load_weights(brush_weights_path, by_name=True) crack_model = modellib.MaskRCNN(mode="inference", config=crack_config, model_dir=DEFAULT_LOGS_DIR) crack_weights_path = DEFAULT_CRACK_DIR #### MASK-R-CNN crack with tf.device('/gpu:1'): crack_model.load_weights(crack_weights_path, by_name=True)