Spaces:
Sleeping
Sleeping
| import tensorflow as tf | |
| from tensorflow.keras import layers, models | |
| from tensorflow.keras.applications import InceptionV3 | |
| def create_model(): | |
| base_model = InceptionV3(weights='imagenet', include_top=False, input_shape=(150, 150, 3)) | |
| base_model.trainable = False # Freezing the base model layers | |
| model = models.Sequential([ | |
| base_model, | |
| layers.GlobalAveragePooling2D(), | |
| layers.Dense(512, activation='relu'), | |
| layers.Dropout(0.5), | |
| layers.Dense(1, activation='sigmoid') | |
| ]) | |
| model.compile(optimizer=tf.keras.optimizers.Adam(learning_rate=0.0001), | |
| loss='binary_crossentropy', | |
| metrics=['accuracy']) | |
| return model | |