ยป Keras API reference / KerasCV / Models / DenseNet models

DenseNet models

[source]

DenseNet121 function

keras_cv.models.DenseNet121(
    include_rescaling,
    include_top,
    classes=None,
    weights=None,
    input_shape=(None, None, 3),
    input_tensor=None,
    pooling=None,
    name="DenseNet121",
    **kwargs
)

Instantiates the DenseNet121 architecture.

Reference

This function returns a Keras DenseNet121 model.

For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.

Arguments

  • include_rescaling: whether or not to Rescale the inputs.If set to True, inputs will be passed through a Rescaling(1/255.0) layer.
  • include_top: whether to include the fully-connected layer at the top of the network. If provided, classes must be provided.
  • classes: optional number of classes to classify images into, only to be specified if include_top is True.
  • weights: one of None (random initialization), a pretrained weight file path, or a reference to pre-trained weights (e.g. 'imagenet/classification') (see available pre-trained weights in weights.py)
  • input_shape: optional shape tuple, defaults to (None, None, 3).
  • input_tensor: optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  • pooling: optional pooling mode for feature extraction when include_top is False. - None means that the output of the model will be the 4D tensor output of the last convolutional block. - avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor. - max means that global max pooling will be applied.
  • name: (Optional) name to pass to the model. Defaults to "DenseNet121".

Returns

A keras.Model instance.


[source]

DenseNet169 function

keras_cv.models.DenseNet169(
    include_rescaling,
    include_top,
    classes=None,
    weights=None,
    input_shape=(None, None, 3),
    input_tensor=None,
    pooling=None,
    name="DenseNet169",
    **kwargs
)

Instantiates the DenseNet169 architecture.

Reference

This function returns a Keras DenseNet169 model.

For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.

Arguments

  • include_rescaling: whether or not to Rescale the inputs.If set to True, inputs will be passed through a Rescaling(1/255.0) layer.
  • include_top: whether to include the fully-connected layer at the top of the network. If provided, classes must be provided.
  • classes: optional number of classes to classify images into, only to be specified if include_top is True.
  • weights: one of None (random initialization), a pretrained weight file path, or a reference to pre-trained weights (e.g. 'imagenet/classification') (see available pre-trained weights in weights.py)
  • input_shape: optional shape tuple, defaults to (None, None, 3).
  • input_tensor: optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  • pooling: optional pooling mode for feature extraction when include_top is False. - None means that the output of the model will be the 4D tensor output of the last convolutional block. - avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor. - max means that global max pooling will be applied.
  • name: (Optional) name to pass to the model. Defaults to "DenseNet169".

Returns

A keras.Model instance.


[source]

DenseNet201 function

keras_cv.models.DenseNet201(
    include_rescaling,
    include_top,
    classes=None,
    weights=None,
    input_shape=(None, None, 3),
    input_tensor=None,
    pooling=None,
    name="DenseNet201",
    **kwargs
)

Instantiates the DenseNet201 architecture.

Reference

This function returns a Keras DenseNet201 model.

For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.

Arguments

  • include_rescaling: whether or not to Rescale the inputs.If set to True, inputs will be passed through a Rescaling(1/255.0) layer.
  • include_top: whether to include the fully-connected layer at the top of the network. If provided, classes must be provided.
  • classes: optional number of classes to classify images into, only to be specified if include_top is True.
  • weights: one of None (random initialization), a pretrained weight file path, or a reference to pre-trained weights (e.g. 'imagenet/classification') (see available pre-trained weights in weights.py)
  • input_shape: optional shape tuple, defaults to (None, None, 3).
  • input_tensor: optional Keras tensor (i.e. output of layers.Input()) to use as image input for the model.
  • pooling: optional pooling mode for feature extraction when include_top is False. - None means that the output of the model will be the 4D tensor output of the last convolutional block. - avg means that global average pooling will be applied to the output of the last convolutional block, and thus the output of the model will be a 2D tensor. - max means that global max pooling will be applied.
  • name: (Optional) name to pass to the model. Defaults to "DenseNet201".

Returns

A keras.Model instance.