Example #1
0
fuse = Dense(64, activation='relu')(fuse)
fuse = Dropout(0.5)(fuse)
fuse = Dense(16, activation='relu')(fuse)
fuse = Dropout(0.5)(fuse)
fuse = Dense(1, activation='sigmoid')(fuse)
model = Model(inputs=inp, outputs=fuse)

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': SGD(lr=0.001, momentum=0.9),
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 30,
    'epochs': 20,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('ens2'),
}
model.fit(**fit_arg)
Example #2
0
model.add(LSTM(256, return_sequences=True))
model.add(LSTM(64))
model.add(BatchNormalization())
model.add(Dense(16))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': 'sgd',
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/win_train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/win_val.npz')
x_val, y_val = val['xs'], val['ys']

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 40,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('lstm'),
}
model.fit(**fit_arg)
Example #3
0
x = BatchNormalization()(inp)
x = InceptionV3(weights='imagenet', include_top=False, pooling='max')(x)
x = Dense(16, activation='relu')(x)
x = Dropout(0.5)(x)
x = Dense(1, activation='sigmoid')(x)
model = Model(inputs=inp, outputs=x)

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': 'sgd',
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 40,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('inc'),
}
model.fit(**fit_arg)
Example #4
0
x = BatchNormalization()(inp)
x = VGG19(weights='imagenet', include_top=False, pooling='max')(x)
x = Dense(16, activation='relu')(x)
x = Dropout(0.5)(x)
x = Dense(1, activation='sigmoid')(x)
model = Model(inputs=inp, outputs=x)

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': 'sgd',
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 40,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('vgg19'),
}
model.fit(**fit_arg)
Example #5
0
model.add(Flatten())
model.add(Dense(64, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(32, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': 'sgd',
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/win_train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/win_val.npz')
x_val, y_val = val['xs'], val['ys']

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 50,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('conv3d'),
}
model.fit(**fit_arg)
Example #6
0
              include_top=False,
              pooling='max')(x)
x = Dense(16, activation='relu')(x)
x = Dropout(0.5)(x)
x = Dense(1, activation='sigmoid')(x)
model = Model(inputs=inp, outputs=x)

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': 'sgd',
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 40,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('mb'),
}
model.fit(**fit_arg)
Example #7
0
model = Model(inputs=[inp, p1_inp, p2_inp], outputs=fuse)

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': SGD(lr=0.001, momentum=0.9),
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

players_train = np.load('npz/players_train.npz')
p1_train, p2_train = players_train['p1'], players_train['p2']
players_val = np.load('npz/players_val.npz')
p1_val, p2_val = players_val['p1'], players_val['p2']

fit_arg = {
    'x': [x_train, p1_train, p2_train],
    'y': y_train,
    'batch_size': 30,
    'epochs': 50,
    'shuffle': True,
    'validation_data': ([x_val, p1_val, p2_val], y_val),
    'callbacks': get_callbacks('players_' + args.model_name),
}
model.fit(**fit_arg)
Example #8
0
model.add(Dense(2, activation='softmax'))
model.summary()

model_arg = {
    'loss': 'categorical_crossentropy',
    'optimizer': 'sgd',
    'metrics': ['accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

from keras.utils import to_categorical
y_train = to_categorical(y_train, num_classes=2)
y_val = to_categorical(y_val, num_classes=2)

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 40,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('gc', acc='val_acc'),
}
model.fit(**fit_arg)
Example #9
0
model.add(BatchNormalization(input_shape=(224, 224, 3)))
for layer in base.layers:
    model.add(layer)
model.add(Dense(16, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(2, activation='softmax'))
model.summary()

model_arg = {'loss': 'mse', 'optimizer': 'sgd', 'metrics': ['accuracy']}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

y_train = to_categorical(y_train, num_classes=2)
y_val = to_categorical(y_val, num_classes=2)

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 40,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('temp'),
}
model.fit(**fit_arg)
Example #10
0
x = BatchNormalization()(inp)
x = ResNet50(weights='imagenet', include_top=False, pooling='max')(x)
x = Dense(16, activation='relu')(x)
x = Dropout(0.5)(x)
x = Dense(1, activation='sigmoid')(x)
model = Model(inputs=inp, outputs=x)

model_arg = {
    'loss': 'binary_crossentropy',
    'optimizer': 'sgd',
    'metrics': ['binary_accuracy']
}
model.compile(**model_arg)
model.summary()

train = np.load('npz/train.npz')
x_train, y_train = train['xs'], train['ys']
val = np.load('npz/val.npz')
x_val, y_val = val['xs'], val['ys']

fit_arg = {
    'x': x_train,
    'y': y_train,
    'batch_size': 40,
    'epochs': 50,
    'shuffle': True,
    'validation_data': (x_val, y_val),
    'callbacks': get_callbacks('resnet'),
}
model.fit(**fit_arg)