Last active
October 7, 2019 01:35
-
-
Save f-rumblefish/287a4b90dbf734295651d54e5e8673dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.applications.inception_v3 import InceptionV3 | |
from keras.models import Model | |
from keras.layers import Dense, GlobalAveragePooling2D | |
# parameters for architecture | |
input_shape = (224, 224, 3) | |
num_classes = 6 | |
conv_size = 32 | |
# parameters for training | |
batch_size = 32 | |
num_epochs = 20 | |
# load InceptionV3 from Keras | |
InceptionV3_model = InceptionV3(include_top=False, input_shape=input_shape) | |
# add custom Layers | |
x = InceptionV3_model.output | |
x = GlobalAveragePooling2D()(x) | |
x = Dense(512, activation="relu")(x) | |
Custom_Output = Dense(num_classes, activation='softmax')(x) | |
# define the input and output of the model | |
model = Model(inputs = InceptionV3_model.input, outputs = Custom_Output) | |
# compile the model | |
model.compile(loss='categorical_crossentropy', | |
optimizer='adam', | |
metrics=['accuracy']) | |
model.summary() | |
# train the model | |
history = model.fit(x_train, y_train, | |
batch_size=batch_size, | |
epochs=num_epochs, | |
verbose=1, | |
validation_split=0.1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
x_train was not declared.
So there is an error.