When would you choose certain CNN pretrained models?

I'm totally new to the field of deep learning so I'm just trying to get a sense of some of the decisions made, especially with convolutional neural networks. After reading a few blogs/articles about the different pretrained CNN architectures, I'm wondering:

When would you choose a certain architecture over another? I've seen a lot of examples using VGG-16 and I'm curious why this one is the go-to when it seems like such a large (and slow?) way to train? Are there certain examples of applications where one architecture would be better than another?

1 Answer

There is a list of models and their performance and parameter count here. I prefer to use the MobileNet model initially. It is about as accurate as VGG but has about 4 million parameters versus the 140 million for VGG. Thus from a computational standpoint and thus training time it is far more efficient. If you modify it to use the callbacks ReduceLROnPlateau and ModelCheckpoint (documentation is here) you can in most cases achieve very good performance. I have found using the Adamax optimizer works very well, documentation for that is here. The code to use MobileNet is shown below

mobile = tf.keras.applications.mobilenet.MobileNet( include_top=False,
input_shape=(image_size,image_size,3),
pooling='avg', weights='imagenet',
alpha=1, depth_multiplier=1)
x=mobile.layers[-1].output
x=keras.layers.BatchNormalization(axis=-1, momentum=0.99, epsilon=0.001 )(x)
predictions=Dense (len(classes), activation='softmax')(x)
model = Model(inputs=mobile.input, outputs=predictions)
for layer in model.layers:
layer.trainable=True
model.compile(Adamax(lr=lr_rate), loss='categorical_crossentropy', metrics=['accuracy'])


If the model does not train well on your data set you can add more dense layers but it is always best to keep the model as simple as possible initially and try to optimize the hyper-parameters before making your model more complex.

• Thanks for your answer. It definitely helps. I'm just also curious if you suggest using MobileNet as a starting point because it's simpler, but is there ever a situation where you would suggest different architectures based on the application of the CNN? Like if object localization was the goal, a certain architecture would be suggested and if object recognition was the task, another architecture would be suggested?
– nmtp
Apr 30 '20 at 18:54
• Sorry do not have specific knowledge on that as I have been focused on classification problems. Apr 30 '20 at 19:03