Keras 3 API 文档 / KerasCV / 模型 / 主干网络 / VGG16 主干网络

VGG16 主干网络

[源代码]

VGG16Backbone

keras_cv.models.VGG16Backbone(
    include_rescaling,
    include_top,
    input_tensor=None,
    num_classes=None,
    input_shape=(224, 224, 3),
    pooling=None,
    classifier_activation="softmax",
    name="VGG16",
    **kwargs
)

参考: - 用于大规模图像识别的超深卷积网络 (ICLR 2015) 此类表示 VGG16 模型的 Keras 主干网络。 **参数**

  • include_rescaling: bool,是否对输入进行重新缩放。如果设置为 True,输入将通过一个 Rescaling(1/255.0) 层。
  • include_top: bool,是否包含网络顶部的 3 个全连接层。如果提供,则必须提供 num_classes。
  • num_classes: int,可选,要将图像分类的类别数,仅在 include_top 为 True 时指定。
  • input_shape: tuple,可选形状元组,默认值为 (224, 224, 3)。
  • input_tensor: Tensor,可选 Keras 张量(即 layers.Input() 的输出),用作模型的图像输入。
  • pooling: bool,可选,在 include_topFalse 时用于特征提取的池化模式。
    • None 表示模型的输出将是最后一个卷积块的 4D 张量输出。
    • avg 表示将对最后一个卷积块的输出应用全局平均池化,因此模型的输出将是一个 2D 张量。
    • max 表示将应用全局最大池化。
  • classifier_activation: str 或可调用对象。要对“顶层”使用的激活函数。仅在 include_top=True 时忽略。将 classifier_activation=None 设置为返回“顶层”的 logits。加载预训练权重时,classifier_activation 只能为 None"softmax"
  • name: (可选)传递给模型的名称,默认为“VGG16”。

返回

一个 keras.Model 实例。


[源代码]

from_preset 方法

VGG16Backbone.from_preset()

未实现。

此类没有可用的预设。