Update models.py
Browse files
models.py
CHANGED
|
@@ -27,20 +27,34 @@
|
|
| 27 |
# return model
|
| 28 |
|
| 29 |
|
| 30 |
-
from tensorflow.keras.applications import VGG19, EfficientNetB0, DenseNet121
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
from tensorflow.keras.models import Model
|
| 32 |
|
| 33 |
def create_vgg19_model():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
base_model = VGG19(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
def create_efficientnet_model():
|
| 39 |
-
base_model = EfficientNetB0(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
|
| 40 |
-
model = Model(inputs=base_model.input, outputs=base_model.get_layer("top_conv").output)
|
| 41 |
-
return model
|
| 42 |
-
|
| 43 |
-
def create_densenet_model():
|
| 44 |
-
base_model = DenseNet121(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
|
| 45 |
-
model = Model(inputs=base_model.input, outputs=base_model.get_layer("conv5_block16_concat").output)
|
| 46 |
-
return model
|
|
|
|
| 27 |
# return model
|
| 28 |
|
| 29 |
|
| 30 |
+
# from tensorflow.keras.applications import VGG19, EfficientNetB0, DenseNet121
|
| 31 |
+
# from tensorflow.keras.models import Model
|
| 32 |
+
|
| 33 |
+
# def create_vgg19_model():
|
| 34 |
+
# base_model = VGG19(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
|
| 35 |
+
# model = Model(inputs=base_model.input, outputs=base_model.get_layer("block5_conv4").output)
|
| 36 |
+
# return model
|
| 37 |
+
|
| 38 |
+
# def create_efficientnet_model():
|
| 39 |
+
# base_model = EfficientNetB0(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
|
| 40 |
+
# model = Model(inputs=base_model.input, outputs=base_model.get_layer("top_conv").output)
|
| 41 |
+
# return model
|
| 42 |
+
|
| 43 |
+
# def create_densenet_model():
|
| 44 |
+
# base_model = DenseNet121(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
|
| 45 |
+
# model = Model(inputs=base_model.input, outputs=base_model.get_layer("conv5_block16_concat").output)
|
| 46 |
+
# return model
|
| 47 |
+
|
| 48 |
+
|
| 49 |
+
|
| 50 |
+
from tensorflow.keras.applications import VGG19
|
| 51 |
from tensorflow.keras.models import Model
|
| 52 |
|
| 53 |
def create_vgg19_model():
|
| 54 |
+
"""
|
| 55 |
+
Loads the VGG19 model with ImageNet weights and removes the top classification layers.
|
| 56 |
+
The output will be the last convolutional layer's output (used for Grad-CAM).
|
| 57 |
+
"""
|
| 58 |
base_model = VGG19(weights='imagenet', include_top=False, input_shape=(224, 224, 3))
|
| 59 |
+
return Model(inputs=base_model.input, outputs=base_model.output)
|
| 60 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|