(session)
| 11 | |
| 12 | |
| 13 | def get_model(session): |
| 14 | |
| 15 | # create the base pre-trained model |
| 16 | base_model = Xception(weights=None, include_top=False, input_shape=(270, 480, 3)) |
| 17 | |
| 18 | # add a global spatial average pooling layer |
| 19 | x = base_model.output |
| 20 | x = GlobalAveragePooling2D()(x) |
| 21 | # add a fully-connected layer |
| 22 | x = Dense(1024, activation='relu')(x) |
| 23 | # putput layer |
| 24 | predictions = Dense(session.training_dataset_info['number_of_labels'], activation='softmax')(x) |
| 25 | # model |
| 26 | model = Model(inputs=base_model.input, outputs=predictions) |
| 27 | |
| 28 | learning_rate = 0.001 |
| 29 | opt = keras.optimizers.adam(lr=learning_rate, decay=1e-5) |
| 30 | |
| 31 | model.compile(loss='categorical_crossentropy', |
| 32 | optimizer=opt, |
| 33 | metrics=['accuracy']) |
| 34 | |
| 35 | return model |
nothing calls this directly
no outgoing calls
no test coverage detected