MCPcopy Create free account
hub / github.com/Sentdex/pygta5 / get_model

Function get_model

original_project/xception.py:13–35  ·  view source on GitHub ↗
(session)

Source from the content-addressed store, hash-verified

11
12
13def 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

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected