Keras – Pre-Trained Models

  • Post author:
  • Post category:Keras
  • Post comments:1 Comment
Keras Pre-Trained Models

In this chapter, we will learn about the Keras pre-trained models . Let us begin with VGG16.

VGG16

VGG16 is another pre-trained model. It is also trained using ImageNet. The syntax to load the model is as follows −

keras.applications.vgg16.VGG16(
   include_top = True, 
   weights = 'imagenet', 
   input_tensor = None, 
   input_shape = None, 
   pooling = None, 
   classes = 1000
)

The default input size for this model is 224×224.

MobileNetV2

MobileNetV2 is another pre-trained model. It is also trained uing ImageNet.

The syntax to load the model is as follows −

keras.applications.mobilenet_v2.MobileNetV2 (
   input_shape = None, 
   alpha = 1.0, 
   include_top = True, 
   weights = 'imagenet', 
   input_tensor = None, 
   pooling = None, 
   classes = 1000
)

Here,

alpha controls the width of the network. If the value is below 1, decreases the number of filters in each layer. If the value is above 1, increases the number of filters in each layer. If alpha = 1, default number of filters from the paper are used at each layer.

The default input size for this model is 224×224.

InceptionResNetV2

InceptionResNetV2 is another pre-trained model. It is also trained using ImageNet. The syntax to load the model is as follows −

keras.applications.inception_resnet_v2.InceptionResNetV2 (
   include_top = True, 
   weights = 'imagenet',
   input_tensor = None, 
   input_shape = None, 
   pooling = None, 
   classes = 1000)

This model and can be built both with ‘channels_first’ data format (channels, height, width) or ‘channels_last’ data format (height, width, channels).

The default input size for this model is 299×299.

InceptionV3

InceptionV3 is another pre-trained model. It is also trained uing ImageNet. The syntax to load the model is as follows −

keras.applications.inception_v3.InceptionV3 (
   include_top = True, 
   weights = 'imagenet', 
   input_tensor = None, 
   input_shape = None, 
   pooling = None, 
   classes = 1000
)

Here,

The default input size for this model is 299×299.

Conclusion

Keras is very simple, extensible and easy to implement neural network API, which can be used to build deep learning applications with high level abstraction. Keras is an optimal choice for deep leaning models.

Learn More

This Post Has One Comment

Leave a Reply