units = [4096, 4096] # ①
dense_convs = []
for filter_idx in range(len(units)):
dense_conv = keras.layers.Conv2D(
filters=units[filter_idx], kernel_size=(7, 7) if filter_idx == 0 else (1,
1),strides=(1, 1), activation="relu", padding="same", use_bias=False, kernel_initializer=tf.constant_initializer(1.0),
)
dense_convs.append(dense_conv)
dropout_layer = keras.layers.Dropout(0.5)
dense_convs.append(dropout_layer)
dense_convs = keras.Sequential(dense_convs) # ②
dense_convs.trainable = False # ③
x[-1] = dense_convs(x[-1])
pool3_output, pool4_output, pool5_output = x