0
$\begingroup$

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?

$\endgroup$
1
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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? $\endgroup$
    – nmtp
    Apr 30 '20 at 18:54
  • $\begingroup$ Sorry do not have specific knowledge on that as I have been focused on classification problems. $\endgroup$
    – Gerry P
    Apr 30 '20 at 19:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.