from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation,Conv2D, MaxPooling2D,Flatten
import tensorflow as tf
from tensorflow.keras.applications import ResNet50, ResNet101, VGG16, VGG19, DenseNet121


def create_ResNet50_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        ResNet50(include_top=False,
                 weights='imagenet',
                 input_shape=input_shape),
        GlobalAveragePooling2D(),
        Dense(num_classes),
        Activation("softmax")
    ])
    model.summary()
    return model


def create_ResNet101_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        ResNet101(include_top=False,
                 weights='imagenet',
                 input_shape=input_shape),
        GlobalAveragePooling2D(),
        Dense(num_classes),
        Activation("softmax")
    ])
    model.summary()
    return model


def create_VGG16_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        VGG16(include_top=False,
                 weights='imagenet',
                 input_shape=input_shape),
        GlobalAveragePooling2D(),
        Dense(num_classes),
        Activation("softmax")
    ])
    model.summary()
    return model


def create_VGG19_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        VGG19(include_top=False,
                 weights='imagenet',
                 input_shape=input_shape),
        GlobalAveragePooling2D(),
        Dense(num_classes),
        Activation("softmax")
    ])
    model.summary()
    return model


def create_DenseNet121_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        DenseNet121(include_top=False,
                 weights='imagenet',
                 input_shape=input_shape),
        GlobalAveragePooling2D(),
        Dense(num_classes),
        Activation("softmax")
    ])
    model.summary()
    return model


def create_CNN_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        Conv2D(32, (3, 3), activation='relu', input_shape=input_shape),
        Conv2D(32, (3, 3), activation='relu'),
        MaxPooling2D(pool_size=(2, 2)),
        Flatten(),
        Dense(128, activation='relu'),
        Dense(num_classes),
        Activation('softmax')
    ])
    model.summary()
    return model


def create_Dense_3_layer_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        Dense(512, activation='relu', input_shape=input_shape),
        Dense(256, activation='relu'),
        Dense(128, activation='relu'),
        Dense(num_classes),
        Activation('softmax')
    ])
    model.summary()
    return model


def create_Dense_4_layer_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        Dense(1024, activation='relu', input_shape=input_shape),
        Dense(512, activation='relu'),
        Dense(256, activation='relu'),
        Dense(128, activation='relu'),
        Dense(num_classes),
        Activation('softmax')
    ])
    model.summary()
    return model


def create_Dense_5_layer_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        Dense(2048, activation='relu', input_shape=input_shape),
        Dense(1024, activation='relu'),
        Dense(512, activation='relu'),
        Dense(256, activation='relu'),
        Dense(128, activation='relu'),
        Dense(num_classes),
        Activation('softmax')
    ])
    model.summary()
    return model


def create_Dense_6_layer_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        Dense(4096, activation='relu', input_shape=input_shape),
        Dense(2048, activation='relu'),
        Dense(1024, activation='relu'),
        Dense(512, activation='relu'),
        Dense(256, activation='relu'),
        Dense(128, activation='relu'),
        Dense(num_classes),
        Activation('softmax')
    ])
    model.summary()
    return model


def create_Dense_7_layer_model(input_shape, num_classes):
    model = tf.keras.Sequential([
        Dense(8192, activation='relu', input_shape=input_shape),
        Dense(4096, activation='relu'),
        Dense(2048, activation='relu'),
        Dense(1024, activation='relu'),
        Dense(512, activation='relu'),
        Dense(256, activation='relu'),
        Dense(128, activation='relu'),
        Dense(num_classes),
        Activation('softmax')
    ])
    model.summary()
    return model

tensorflow.keras.layers.GlobalAveragePooling2D tensorflow.keras.layers.Activation tensorflow.keras.layers.Dense tensorflow.keras.layers.Conv2D tensorflow.keras.applications.VGG19 tensorflow.keras.layers.MaxPooling2D tensorflow.keras.applications.ResNet50 tensorflow.keras.applications.ResNet101 tensorflow.keras.applications.VGG16 tensorflow.keras.applications.DenseNet121 tensorflow.keras.layers.Flatten
[(8, 'tensorflow.keras.applications.ResNet50', 'ResNet50', ([], {'include_top': '(False)', 'weights': '"""imagenet"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.applications import ResNet50, ResNet101, VGG16, VGG19, DenseNet121\n'), (11, 'tensorflow.keras.layers.GlobalAveragePooling2D', 'GlobalAveragePooling2D', ([], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (12, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (13, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (21, 'tensorflow.keras.applications.ResNet101', 'ResNet101', ([], {'include_top': '(False)', 'weights': '"""imagenet"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.applications import ResNet50, ResNet101, VGG16, VGG19, DenseNet121\n'), (24, 'tensorflow.keras.layers.GlobalAveragePooling2D', 'GlobalAveragePooling2D', ([], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (25, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (26, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (34, 'tensorflow.keras.applications.VGG16', 'VGG16', ([], {'include_top': '(False)', 'weights': '"""imagenet"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.applications import ResNet50, ResNet101, VGG16, VGG19, DenseNet121\n'), (37, 'tensorflow.keras.layers.GlobalAveragePooling2D', 'GlobalAveragePooling2D', ([], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (38, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (39, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (47, 'tensorflow.keras.applications.VGG19', 'VGG19', ([], {'include_top': '(False)', 'weights': '"""imagenet"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.applications import ResNet50, ResNet101, VGG16, VGG19, DenseNet121\n'), (50, 'tensorflow.keras.layers.GlobalAveragePooling2D', 'GlobalAveragePooling2D', ([], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (51, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (52, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (60, 'tensorflow.keras.applications.DenseNet121', 'DenseNet121', ([], {'include_top': '(False)', 'weights': '"""imagenet"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.applications import ResNet50, ResNet101, VGG16, VGG19, DenseNet121\n'), (63, 'tensorflow.keras.layers.GlobalAveragePooling2D', 'GlobalAveragePooling2D', ([], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (64, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (65, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (73, 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(32)', '(3, 3)'], {'activation': '"""relu"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (74, 'tensorflow.keras.layers.Conv2D', 'Conv2D', (['(32)', '(3, 3)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (75, 'tensorflow.keras.layers.MaxPooling2D', 'MaxPooling2D', ([], {'pool_size': '(2, 2)'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (76, 'tensorflow.keras.layers.Flatten', 'Flatten', ([], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (77, 'tensorflow.keras.layers.Dense', 'Dense', (['(128)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (78, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (79, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (87, 'tensorflow.keras.layers.Dense', 'Dense', (['(512)'], {'activation': '"""relu"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (88, 'tensorflow.keras.layers.Dense', 'Dense', (['(256)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (89, 'tensorflow.keras.layers.Dense', 'Dense', (['(128)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (90, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (91, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (99, 'tensorflow.keras.layers.Dense', 'Dense', (['(1024)'], {'activation': '"""relu"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (100, 'tensorflow.keras.layers.Dense', 'Dense', (['(512)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (101, 'tensorflow.keras.layers.Dense', 'Dense', (['(256)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (102, 'tensorflow.keras.layers.Dense', 'Dense', (['(128)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (103, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (104, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (112, 'tensorflow.keras.layers.Dense', 'Dense', (['(2048)'], {'activation': '"""relu"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (113, 'tensorflow.keras.layers.Dense', 'Dense', (['(1024)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (114, 'tensorflow.keras.layers.Dense', 'Dense', (['(512)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (115, 'tensorflow.keras.layers.Dense', 'Dense', (['(256)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (116, 'tensorflow.keras.layers.Dense', 'Dense', (['(128)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (117, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (118, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (126, 'tensorflow.keras.layers.Dense', 'Dense', (['(4096)'], {'activation': '"""relu"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (127, 'tensorflow.keras.layers.Dense', 'Dense', (['(2048)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (128, 'tensorflow.keras.layers.Dense', 'Dense', (['(1024)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (129, 'tensorflow.keras.layers.Dense', 'Dense', (['(512)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (130, 'tensorflow.keras.layers.Dense', 'Dense', (['(256)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (131, 'tensorflow.keras.layers.Dense', 'Dense', (['(128)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (132, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (133, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (141, 'tensorflow.keras.layers.Dense', 'Dense', (['(8192)'], {'activation': '"""relu"""', 'input_shape': 'input_shape'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (142, 'tensorflow.keras.layers.Dense', 'Dense', (['(4096)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (143, 'tensorflow.keras.layers.Dense', 'Dense', (['(2048)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (144, 'tensorflow.keras.layers.Dense', 'Dense', (['(1024)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (145, 'tensorflow.keras.layers.Dense', 'Dense', (['(512)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (146, 'tensorflow.keras.layers.Dense', 'Dense', (['(256)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (147, 'tensorflow.keras.layers.Dense', 'Dense', (['(128)'], {'activation': '"""relu"""'}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (148, 'tensorflow.keras.layers.Dense', 'Dense', (['num_classes'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n'), (149, 'tensorflow.keras.layers.Activation', 'Activation', (['"""softmax"""'], {}), False, 'from tensorflow.keras.layers import GlobalAveragePooling2D, Dense, Activation, Conv2D, MaxPooling2D, Flatten\n')]