Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
880 B
2
Indexable
Never
def conv_model():
    x = Input(shape=(32, 32, 3))
    c1 = Conv2D(64, (3, 3), activation='relu', padding='same')(x)
    c2 = Conv2D(64, (3, 3), activation='relu', padding='same')(c1)
    p1 = MaxPool2D((2, 2))(c2)
    d1 = Dropout(0.25)(p1)

    c3 = Conv2D(128, (3, 3), activation='relu', padding='same')(d1)
    c4 = Conv2D(128, (3, 3), activation='relu', padding='same')(c3)
    p2 = MaxPool2D((2, 2))(c4)
    d2 = Dropout(0.5)(p2)

    xf = Flatten()(d2)
    l1 = Dense(512, activation='relu')(xf)
    d3 = Dropout(0.5)(l1)
    y = Dense(25, activation='softmax')(d3)
    return Model(inputs=x, outputs=y)

model = conv_model()

model.compile(loss='sparse_categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
cb = [ModelCheckpoint('/content/drive/My Drive/Colab Notebooks/ZMUM_2023_24/model_zad.h5', monitor='val_accuracy', save_best_only=True)]
model.summary()