Some tips about using Keras
1. How to use part of a model
1 2 3 4 |
model = load_model(sys.argv[1], custom_objects = {'fmeasure': fmeasure}) branch_model = model.get_layer(name = 'model_1') img_embed = Model(inputs = [branch_model.get_input_at(0)], outputs = [branch_model.get_output_at(0)]) |
The ‘img_embed’ model is part of ‘branch_model’. We should realise that ‘Model()’ is a heavy cpu-cost function so it need to be create only once and then could be used many times. 2. How to save a model when using ‘multi_gpu_model’… Read more »