Celyrix-1.0-Vision / src /model.py
mikexsav's picture
Release CELYRIX v1.0.0
17124c2
Raw History Blame Contribute Delete
882 Bytes
from src.common import SIZE
def build_model(seed=42):
from tensorflow import keras
layers = keras.layers
inputs = keras.Input((SIZE, SIZE, 3), name="rgb_pixels_0_255")
x = layers.RandomFlip("horizontal_and_vertical", seed=seed)(inputs)
x = layers.RandomRotation(0.5, fill_mode="reflect", seed=seed + 1)(x)
x = layers.Rescaling(1 / 255.0)(x)
for filters in (16, 32, 64):
x = layers.Conv2D(filters, 3, padding="same", use_bias=False)(x)
x = layers.BatchNormalization()(x)
x = layers.Activation("relu")(x)
x = layers.MaxPooling2D()(x)
x = layers.Conv2D(96, 3, padding="same", activation="relu")(x)
x = layers.GlobalAveragePooling2D()(x)
x = layers.Dropout(0.25, seed=seed + 2)(x)
outputs = layers.Dense(5, activation="softmax", name="land_cover")(x)
return keras.Model(inputs, outputs, name="CELYRIX")