English 中文(简体)
Keras - Pre-Trained Models
  • 时间:2024-11-05

Keras - Pre-Trained Models


Previous Page Next Page  

In this chapter, we will learn about the pre-trained models in Keras. 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.apppcations.vgg16.VGG16(
   include_top = True, 
   weights =  imagenet , 
   input_tensor = None, 
   input_shape = None, 
   poopng = None, 
   classes = 1000
)

The default input size for this model is 224x224.

MobileNetV2

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

The syntax to load the model is as follows −


keras.apppcations.mobilenet_v2.MobileNetV2 (
   input_shape = None, 
   alpha = 1.0, 
   include_top = True, 
   weights =  imagenet , 
   input_tensor = None, 
   poopng = 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 224x224.

InceptionResNetV2

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


keras.apppcations.inception_resnet_v2.InceptionResNetV2 (
   include_top = True, 
   weights =  imagenet ,
   input_tensor = None, 
   input_shape = None, 
   poopng = 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 299x299.

InceptionV3

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


keras.apppcations.inception_v3.InceptionV3 (
   include_top = True, 
   weights =  imagenet , 
   input_tensor = None, 
   input_shape = None, 
   poopng = None, 
   classes = 1000
)

Here,

The default input size for this model is 299x299.

Conclusion

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

Advertisements