Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 1.36 KB

Readme.md

File metadata and controls

28 lines (23 loc) · 1.36 KB

Model implementation

P/s: These link is have a complete example of how to train a model. You can use it as a reference. Please make sure that you understand the code before you use it.

# example
import tensorflow as tf
from tensorflow.keras import layers

def get_classification_model(input_shape, num_classes):
    inputs = tf.keras.Input(shape=input_shape)
    x = layers.Conv2D(32, 3, activation="relu")(inputs)
    x = layers.MaxPooling2D()(x)
    x = layers.Conv2D(32, 3, activation="relu")(x)
    x = layers.MaxPooling2D()(x)
    x = layers.Conv2D(32, 3, activation="relu")(x)
    x = layers.Flatten()(x)
    x = layers.Dense(128, activation="relu")(x)
    outputs = layers.Dense(num_classes, activation="softmax")(x)
    model = tf.keras.Model(inputs=inputs, outputs=outputs)
    return model