Ejemplo n.º 1
0
index = list(range(testSize * NUMBER_OF_CLASS))
random.seed(660)
random.shuffle(index)
x_val = x_val[index]
y_val = y_val[index]

model_weights = "./model/aux_model"

checkpoint = ModelCheckpoint(model_weights,
                             monitor='val_loss',
                             verbose=0,
                             save_best_only=True,
                             mode='min',
                             save_weights_only=True)
a_model = fed_learn.create_model((32, 32, 3),
                                 NUMBER_OF_CLASS,
                                 init_with_imagenet=False,
                                 learning_rate=0.01)

plateau = ReduceLROnPlateau(monitor='val_loss',
                            factor=0.5,
                            patience=5,
                            verbose=1,
                            min_delta=1e-4,
                            mode='min')
early_stopping = EarlyStopping(monitor="val_loss", patience=15)
y_train = utils.to_categorical(y_train, NUMBER_OF_CLASS)
print(a_model.summary())
a_model.fit(x_share,
            y_share,
            validation_data=(x_val, y_val),
            epochs=5000,
Ejemplo n.º 2
0
def model_fn():
    return fed_learn.create_model((32, 32, 3),
                                  NUMBER_OF_CLASS,
                                  init_with_imagenet=True,
                                  learning_rate=args.learning_rate)
Ejemplo n.º 3
0
def model_fn():
    return fed_learn.create_model((32, 32, 3), 10, init_with_imagenet=False, learning_rate=args.learning_rate)