I have been training this model for 1 epoch to see if it will work. What I want to do is take an image and create global features for the image. Right now after each training session, the features are all 0. Can someone please tell me the best way to create global features using Keras and cnn?
Here is my model so far.
def create_base_network():
"""
Base network to be shared.
"""
model_input = Input(shape=(224,224,3))
x = Conv2D(64, (3, 3), activation='relu', padding='same')(model_input)
x = MaxPooling2D(pool_size=(2,2))(x)
x = Dropout(0.5)(x)
x = BatchNormalization()(x)
x = Conv2D(128, (3, 3), activation='relu', padding='same')(x)
x = Conv2D(128, (3, 3), activation='relu', padding='same')(x)
x = MaxPooling2D(pool_size=(2,2))(x)
x = Dropout(0.5)(x)
x = BatchNormalization()(x)
x = Conv2D(256, (3, 3), activation='relu', padding='same')(x)
x = Conv2D(256, (3, 3), activation='relu', padding='same')(x)
x = MaxPooling2D(pool_size=(2,2))(x)
x = Conv2D(256, (3, 3), activation='relu', padding='same')(x)
x = Conv2D(256, (3, 3), activation='relu', padding='same')(x)
x = MaxPooling2D(pool_size=(2,2))(x)
x = Dropout(0.5)(x)
x = BatchNormalization()(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same')(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same')(x)
x = MaxPooling2D(pool_size=(2,2))(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same')(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same')(x)
x = Conv2D(512, (3, 3), activation='relu', padding='same')(x)
#x = MaxPooling2D(pool_size=(2,2))(x)
x = Dropout(0.5)(x)
#x = Flatten()(x)
x = Dense(1024, activation='relu')(x)
x = BatchNormalization()(x)
x = Dropout(0.7)(x)
x = Dense(1024, activation='relu')(x)
x = Dense(1024, activation='relu')(x)
x = BatchNormalization()(x)
x = Dropout(0.7)(x)
x = Dense(4096, activation='relu')(x)
x = Dense(4096, activation='relu')(x)
x = BatchNormalization()(x)
x = Dropout(0.7)(x)
# This layer is what the features are
x = Dense(4096, activation='relu')(x)
model = Model(inputs=model_input, outputs=x)
return model
Please and thank you.