Keras – 应用

夜幕星河

Keras – 应用

Keras应用模块用于为深度神经网络提供预训练的模型。Keras模型可用于预测、特征提取和微调。本章详细解释了Keras的应用。

预训练的模型

训练好的模型由两部分组成:模型架构和模型权重。模型权重是大文件,所以我们必须从ImageNet数据库中下载并提取特征。下面列出了一些流行的预训练模型、

  • ResNet
  • VGG16
  • MobileNet
  • InceptionResNetV2
  • InceptionV3

加载一个模型

Keras预训练的模型可以按照下面的规定轻松加载—

import keras 
import numpy as np 

from keras.applications import vgg16, inception_v3, resnet50, mobilenet 

#Load the VGG model 
vgg_model = vgg16.VGG16(weights = 'imagenet') 

#Load the Inception_V3 model 
inception_model = inception_v3.InceptionV3(weights = 'imagenet') 

#Load the ResNet50 model 
resnet_model = resnet50.ResNet50(weights = 'imagenet') 

#Load the MobileNet model mobilenet_model = mobilenet.MobileNet(weights = 'imagenet')

一旦模型被加载,我们就可以立即将其用于预测目的。让我们在接下来的章节中检查每个预训练的模型。

版权声明:本页面内容旨在传播知识,为用户自行发布,若有侵权等问题请及时与本网联系,我们将第一时间处理。E-mail:284563525@qq.com

目录[+]

取消
微信二维码
微信二维码
支付宝二维码