CSPDarkNetBackbone
classkeras_cv.models.CSPDarkNetBackbone(
stackwise_channels,
stackwise_depth,
include_rescaling,
use_depthwise=False,
input_shape=(None, None, 3),
input_tensor=None,
**kwargs
)
This class represents the CSPDarkNet architecture.
Reference
For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.
Arguments
Rescaling(1/255.0)
layer.DarknetConvBlockDepthwise
should be
used over a DarknetConvBlock
, defaults to False.keras.layers.Input()
) to use as image input for the model.Returns
A keras.Model
instance.
Examples
input_data = tf.ones(shape=(8, 224, 224, 3))
# Pretrained backbone
model = keras_cv.models.CSPDarkNetBackbone.from_preset(
"csp_darknet_tiny_imagenet"
)
output = model(input_data)
# Randomly initialized backbone with a custom config
model = keras_cv.models.CSPDarkNetBackbone(
stackwise_channels=[128, 256, 512, 1024],
stackwise_depth=[3, 9, 9, 3],
include_rescaling=False,
)
output = model(input_data)
from_preset
methodCSPDarkNetBackbone.from_preset()
Instantiate CSPDarkNetBackbone model from preset config and weights.
Arguments
None
, which follows whether the preset has
pretrained weights available.Examples
# Load architecture and weights from preset
model = keras_cv.models.CSPDarkNetBackbone.from_preset(
"csp_darknet_tiny_imagenet",
)
# Load randomly initialized model from preset architecture with weights
model = keras_cv.models.CSPDarkNetBackbone.from_preset(
"csp_darknet_tiny_imagenet",
load_weights=False,
Preset name | Parameters | Description |
---|---|---|
csp_darknet_tiny | 2.38M | CSPDarkNet model with [48, 96, 192, 384] channels and [1, 3, 3, 1] depths where the batch normalization and SiLU activation are applied after the convolution layers. |
csp_darknet_s | 4.22M | CSPDarkNet model with [64, 128, 256, 512] channels and [1, 3, 3, 1] depths where the batch normalization and SiLU activation are applied after the convolution layers. |
csp_darknet_m | 12.37M | CSPDarkNet model with [96, 192, 384, 768] channels and [2, 6, 6, 2] depths where the batch normalization and SiLU activation are applied after the convolution layers. |
csp_darknet_l | 27.11M | CSPDarkNet model with [128, 256, 512, 1024] channels and [3, 9, 9, 3] depths where the batch normalization and SiLU activation are applied after the convolution layers. |
csp_darknet_xl | 56.84M | CSPDarkNet model with [170, 340, 680, 1360] channels and [4, 12, 12, 4] depths where the batch normalization and SiLU activation are applied after the convolution layers. |
csp_darknet_tiny_imagenet | 2.38M | CSPDarkNet model with [48, 96, 192, 384] channels and [1, 3, 3, 1] depths where the batch normalization and SiLU activation are applied after the convolution layers. Trained on Imagenet 2012 classification task. |
csp_darknet_l_imagenet | 27.11M | CSPDarkNet model with [128, 256, 512, 1024] channels and [3, 9, 9, 3] depths where the batch normalization and SiLU activation are applied after the convolution layers. Trained on Imagenet 2012 classification task. |
CSPDarkNetTinyBackbone
classkeras_cv.models.CSPDarkNetTinyBackbone(
stackwise_channels,
stackwise_depth,
include_rescaling,
use_depthwise=False,
input_shape=(None, None, 3),
input_tensor=None,
**kwargs
)
CSPDarkNetBackbone model with [48, 96, 192, 384] channels and [1, 3, 3, 1] depths.
Reference
For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.
Arguments
Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.Example
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone
model = CSPDarkNetTinyBackbone()
output = model(input_data)
CSPDarkNetSBackbone
classkeras_cv.models.CSPDarkNetSBackbone(
stackwise_channels,
stackwise_depth,
include_rescaling,
use_depthwise=False,
input_shape=(None, None, 3),
input_tensor=None,
**kwargs
)
CSPDarkNetBackbone model with [64, 128, 256, 512] channels and [1, 3, 3, 1] depths.
Reference
For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.
Arguments
Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.Example
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone
model = CSPDarkNetSBackbone()
output = model(input_data)
CSPDarkNetMBackbone
classkeras_cv.models.CSPDarkNetMBackbone(
stackwise_channels,
stackwise_depth,
include_rescaling,
use_depthwise=False,
input_shape=(None, None, 3),
input_tensor=None,
**kwargs
)
CSPDarkNetBackbone model with [96, 192, 384, 768] channels and [2, 6, 6, 2] depths.
Reference
For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.
Arguments
Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.Example
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone
model = CSPDarkNetMBackbone()
output = model(input_data)
CSPDarkNetLBackbone
classkeras_cv.models.CSPDarkNetLBackbone(
stackwise_channels,
stackwise_depth,
include_rescaling,
use_depthwise=False,
input_shape=(None, None, 3),
input_tensor=None,
**kwargs
)
CSPDarkNetBackbone model with [128, 256, 512, 1024] channels and [3, 9, 9, 3] depths.
Reference
For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.
Arguments
Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.Example
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone
model = CSPDarkNetLBackbone()
output = model(input_data)
CSPDarkNetXLBackbone
classkeras_cv.models.CSPDarkNetXLBackbone(
stackwise_channels,
stackwise_depth,
include_rescaling,
use_depthwise=False,
input_shape=(None, None, 3),
input_tensor=None,
**kwargs
)
CSPDarkNetBackbone model with [170, 340, 680, 1360] channels and [4, 12, 12, 4] depths.
Reference
For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.
Arguments
Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.Example
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone
model = CSPDarkNetXLBackbone()
output = model(input_data)