mirror of
https://github.com/jung-geun/PSO.git
synced 2025-12-19 20:44:39 +09:00
23-07-09
dev container 조정
This commit is contained in:
19
mnist_tf.py
19
mnist_tf.py
@@ -43,21 +43,14 @@ def get_data_test():
|
||||
def make_model():
|
||||
model = Sequential()
|
||||
model.add(
|
||||
Conv2D(
|
||||
32,
|
||||
kernel_size=(5, 5),
|
||||
strides=(1, 1),
|
||||
padding="same",
|
||||
activation="relu",
|
||||
input_shape=(28, 28, 1),
|
||||
)
|
||||
Conv2D(32, kernel_size=(5, 5), activation="relu", input_shape=(28, 28, 1))
|
||||
)
|
||||
model.add(MaxPooling2D(pool_size=(2, 2), strides=(2, 2)))
|
||||
model.add(Conv2D(64, kernel_size=(2, 2), activation="relu", padding="same"))
|
||||
model.add(MaxPooling2D(pool_size=(3, 3)))
|
||||
model.add(Conv2D(64, kernel_size=(3, 3), activation="relu"))
|
||||
model.add(MaxPooling2D(pool_size=(2, 2)))
|
||||
model.add(Dropout(0.25))
|
||||
model.add(Flatten())
|
||||
model.add(Dense(1000, activation="relu"))
|
||||
model.add(Dense(128, activation="relu"))
|
||||
model.add(Dense(10, activation="softmax"))
|
||||
|
||||
return model
|
||||
@@ -66,7 +59,9 @@ def make_model():
|
||||
model = make_model()
|
||||
x_train, y_train, x_test, y_test = get_data()
|
||||
|
||||
model.compile(optimizer="adam", loss="sparse_categorical_crossentropy", metrics=["accuracy"])
|
||||
model.compile(
|
||||
optimizer="sgd", loss="sparse_categorical_crossentropy", metrics=["accuracy"]
|
||||
)
|
||||
|
||||
print("Training model...")
|
||||
model.fit(x_train, y_train, epochs=1000, batch_size=128, verbose=1)
|
||||
|
||||
Reference in New Issue
Block a user