DenseNet121
unknown
python
7 months ago
750 B
3
Indexable
Never
def build_densenet(): densenet = DenseNet121(weights='imagenet', include_top=False) input = Input(shape=(SIZE, SIZE, N_ch)) x = Conv2D(3, (3, 3), padding='same')(input) x = densenet(x) x = GlobalAveragePooling2D()(x) x = BatchNormalization()(x) x = Dropout(0.5)(x) x = Dense(256, activation='relu')(x) x = BatchNormalization()(x) x = Dropout(0.5)(x) # multi output output = Dense(4,activation = 'softmax', name='root')(x) # model model = Model(input,output) optimizer = Adam(lr=0.002, beta_1=0.9, beta_2=0.999, epsilon=0.1, decay=0.0) model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['accuracy']) model.summary() return model
Leave a Comment