Skip to content

Commit

Permalink
add coco config
Browse files Browse the repository at this point in the history
  • Loading branch information
bendangnuksung committed Apr 15, 2019
1 parent 6c2fe6c commit 4e47cdb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
22 changes: 21 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,21 @@
K.set_session(sess)


def get_config():
if is_coco:
import coco
class InferenceConfig(coco.CocoConfig):
GPU_COUNT = 1
IMAGES_PER_GPU = 1

config = InferenceConfig()

else:
config = mask_config(NUMBER_OF_CLASSES)

return config


def freeze_session(session, keep_var_names=None, output_names=None, clear_devices=True):
graph = sess.graph

Expand Down Expand Up @@ -82,8 +97,13 @@ def make_serving_ready(model_path, save_serve_path, version_number):
print("*" * 80)


# Load Mask RCNN config
# you can also load your own config in here.
# config = your_custom_config_class
config = get_config()


# LOAD MODEL
config = mask_config(NUMBER_OF_CLASSES)
model = MaskRCNN(mode="inference", model_dir=MODEL_DIR, config=config)
model.load_weights(H5_WEIGHT_PATH, by_name=True)

Expand Down
3 changes: 3 additions & 0 deletions user_config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# User Define parameters

# Make it True if you want to use the provided coco weights
is_coco = False

# keras model directory path
MODEL_DIR = '/keras_model/'

Expand Down

0 comments on commit 4e47cdb

Please sign in to comment.