|
from tensorflow.keras.models import Sequential
|
|
import tensorflow.keras.layers as tfl
|
|
|
|
def cat_dog_model(image_size, image_channel):
|
|
model = Sequential([
|
|
|
|
tfl.Conv2D(32, (3, 3), activation='relu', input_shape=(image_size, image_size, image_channel)),
|
|
tfl.BatchNormalization(),
|
|
tfl.MaxPooling2D(pool_size=(2, 2)),
|
|
tfl.Dropout(0.2),
|
|
|
|
|
|
tfl.Conv2D(64, (3, 3), activation='relu'),
|
|
tfl.BatchNormalization(),
|
|
tfl.MaxPooling2D(pool_size=(2, 2)),
|
|
tfl.Dropout(0.2),
|
|
|
|
|
|
tfl.Conv2D(128, (3, 3), activation='relu'),
|
|
tfl.BatchNormalization(),
|
|
tfl.MaxPooling2D(pool_size=(2, 2)),
|
|
tfl.Dropout(0.2),
|
|
|
|
|
|
tfl.Conv2D(256, (3, 3), activation='relu'),
|
|
tfl.BatchNormalization(),
|
|
tfl.MaxPooling2D(pool_size=(2, 2)),
|
|
tfl.Dropout(0.2),
|
|
|
|
|
|
tfl.Flatten(),
|
|
tfl.Dense(512, activation='relu'),
|
|
tfl.BatchNormalization(),
|
|
tfl.Dropout(0.2),
|
|
|
|
|
|
tfl.Dense(1, activation='sigmoid')
|
|
])
|
|
|
|
return model
|
|
|