def build_model_kernel_cascade753(): input_shape_img = utils.get_rgb_input_shape(IMG_ROWS, IMG_COLUMNS) num_classes = 2 large_kernel_shape = (7, 7) medium_kernel_shape = (5, 5) small_kernel_shape = (3, 3) model = Sequential() model.add( Conv2D(48, kernel_size=large_kernel_shape, activation='relu', padding='same', input_shape=input_shape_img)) model.add( Conv2D(48, kernel_size=large_kernel_shape, activation='relu', padding='same')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add( Conv2D(64, kernel_size=medium_kernel_shape, activation='relu', padding='same')) model.add( Conv2D(64, kernel_size=medium_kernel_shape, activation='relu', padding='same')) model.add(Conv2D(32, kernel_size=(1, 1), activation='relu', padding='same')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add( Conv2D(16, kernel_size=small_kernel_shape, activation='relu', padding='same')) model.add( Conv2D(16, kernel_size=small_kernel_shape, activation='relu', padding='same')) model.add(Conv2D(8, kernel_size=(1, 1), activation='relu', padding='same')) model.add(GlobalAveragePooling2D()) model.add(Dense(num_classes, activation='softmax')) model.compile(loss=keras.losses.categorical_crossentropy, optimizer=keras.optimizers.Adam(), metrics=['accuracy']) model_name = "fcn_kernel_cascade753" return (model, model_name)
def build_model_3modules_cascade753(): input_shape_img = utils.get_rgb_input_shape(IMG_ROWS, IMG_COLUMNS) block1_units = 48 block2_units = 60 block3_units = 72 block1_kernel_shape = (7, 7) block2_kernel_shape = (5, 5) block3_kernel_shape = (3, 3) model = Sequential() model.add(Conv2D(block1_units, kernel_size=block1_kernel_shape, activation='relu', input_shape=input_shape_img, name='input_layer')) model.add(Conv2D(block1_units, kernel_size=block1_kernel_shape, activation='relu', padding='same')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.25)) model.add(Conv2D(block2_units, kernel_size=block2_kernel_shape, activation='relu', padding='same')) model.add(Conv2D(block2_units, kernel_size=block2_kernel_shape, activation='relu', padding='same')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.25)) model.add(Conv2D(block3_units, kernel_size=block3_kernel_shape, activation='relu', padding='same')) model.add(Conv2D(block3_units, kernel_size=block3_kernel_shape, activation='relu', padding='same')) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.25)) model.add(Flatten()) model.add(Dense(DENSE_UNITS, activation='relu')) model.add(Dropout(0.5)) model.add(Dense(NUM_CLASSES, activation='softmax', name='logits_layer')) model.compile(loss=keras.losses.categorical_crossentropy, optimizer=keras.optimizers.Adam(), metrics=['accuracy']) model_name = "vgg_3modules_cascade753_dense{}".format(DENSE_UNITS) return (model, model_name)