x_test = x_test.reshape(x_test.shape[0], x_test.shape[1], x_test.shape[2], aaa) print(x_train.shape, y_train.shape) # (3628, 128, 862, 1) (3628,) print(x_test.shape, y_test.shape) # (908, 128, 862, 1) (908,) model = NASNetMobile( include_top=True, input_shape=(128,862,1), classes=2, pooling=None, weights=None, ) model.summary() # model.trainable = False model.save('C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_sgd_1.h5') # 컴파일, 훈련 op = SGD(lr=1e-2) batch_size = 4 es = EarlyStopping(monitor='val_loss', patience=20, restore_best_weights=True, verbose=1) lr = ReduceLROnPlateau(monitor='val_loss', vactor=0.5, patience=10, verbose=1) path = 'C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_sgd_1.h5' mc = ModelCheckpoint(path, monitor='val_loss', verbose=1, save_best_only=True) model.compile(optimizer=op, loss="sparse_categorical_crossentropy", metrics=['acc']) history = model.fit(x_train, y_train, epochs=1000, batch_size=batch_size, validation_split=0.2, callbacks=[es, lr, mc]) # 평가, 예측 # model = load_model('C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_sgd_1.h5')
x_test = x_test.reshape(x_test.shape[0], x_test.shape[1], x_test.shape[2], aaa) print(x_train.shape, y_train.shape) # (3628, 128, 862, 1) (3628,) print(x_test.shape, y_test.shape) # (908, 128, 862, 1) (908,) model = NASNetMobile( include_top=True, input_shape=(128,862,1), classes=2, pooling=None, weights=None, ) model.summary() # model.trainable = False model.save('C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_adadelta_1.h5') # 컴파일, 훈련 op = Adadelta(lr=1e-3) batch_size = 4 es = EarlyStopping(monitor='val_loss', patience=20, restore_best_weights=True, verbose=1) lr = ReduceLROnPlateau(monitor='val_loss', vactor=0.5, patience=10, verbose=1) path = 'C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_adadelta_1.h5' mc = ModelCheckpoint(path, monitor='val_loss', verbose=1, save_best_only=True) model.compile(optimizer=op, loss="sparse_categorical_crossentropy", metrics=['acc']) history = model.fit(x_train, y_train, epochs=1000, batch_size=batch_size, validation_split=0.2, callbacks=[es, lr, mc]) # 평가, 예측 # model = load_model('C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_adadelta_1.h5')
x_test = x_test.reshape(x_test.shape[0], x_test.shape[1], x_test.shape[2], aaa) print(x_train.shape, y_train.shape) # (3628, 128, 862, 1) (3628,) print(x_test.shape, y_test.shape) # (908, 128, 862, 1) (908,) model = NASNetMobile( include_top=True, input_shape=(128, 862, 1), classes=2, pooling=None, weights=None, ) model.summary() # model.trainable = False model.save('C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_rmsprop_1.h5') # 컴파일, 훈련 op = RMSprop(lr=1e-3) batch_size = 4 es = EarlyStopping(monitor='val_loss', patience=20, restore_best_weights=True, verbose=1) lr = ReduceLROnPlateau(monitor='val_loss', vactor=0.5, patience=10, verbose=1) path = 'C:/nmb/nmb_data/h5/5s/Nasnet/nasnet_rmsprop_1.h5' mc = ModelCheckpoint(path, monitor='val_loss', verbose=1, save_best_only=True) model.compile(optimizer=op, loss="sparse_categorical_crossentropy",