InceptionV3
函数tf_keras.applications.InceptionV3(
include_top=True,
weights="imagenet",
input_tensor=None,
input_shape=None,
pooling=None,
classes=1000,
classifier_activation="softmax",
)
实例化 Inception v3 架构。
参考
此函数返回一个 TF-Keras 图像分类模型,可选择加载在 ImageNet 上预训练的权重。
有关图像分类用例,请参阅此页面获取详细示例。
对于迁移学习用例,请务必阅读迁移学习与微调指南。
注意:每个 TF-Keras Application 都需要特定的输入预处理。对于 InceptionV3
,在将输入传递给模型之前,请对输入调用 tf.keras.applications.inception_v3.preprocess_input
。inception_v3.preprocess_input
会将输入像素缩放到 -1 到 1 之间。
参数
True
。None
(随机初始化)、imagenet
(在 ImageNet 上预训练),或要加载的权重文件的路径。默认为 imagenet
。layers.Input()
的输出),用作模型的图像输入。input_tensor
对于在多个不同网络之间共享输入很有用。默认为 None
。include_top
为 False 时指定(否则输入形状必须为 (299, 299, 3)
(使用 channels_last
数据格式)或 (3, 299, 299)
(使用 channels_first
数据格式)。它应该恰好有 3 个输入通道,且宽度和高度不小于 75。例如,(150, 150, 3)
是一个有效值。如果提供了 input_tensor
,则 input_shape
将被忽略。include_top
为 False
时进行特征提取。None
(默认)表示模型的输出将是最后一个卷积块的 4D 张量输出。avg
表示将对最后一个卷积块的输出应用全局平均池化,因此模型的输出将是一个 2D 张量。max
表示将应用全局最大池化。include_top
为 True 且未指定 weights
参数时指定。默认为 1000。include_top=True
,否则将被忽略。设置 classifier_activation=None
将返回“顶部”层的 logits。加载预训练权重时,classifier_activation
只能是 None
或 "softmax"
。返回
一个 keras.Model
实例。