EfficientNetV1Backbone
classkeras_cv.models.EfficientNetV1Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1 architecture.
Reference
Arguments
Rescaling(1/255.0)
layer.keras.keras.layers.Input()
) to
use as image input for the model.Example
# Construct an EfficientNetV1 from a preset:
efficientnet = keras_cv.models.EfficientNetV1Backbone.from_preset(
"efficientnetv1_b0"
)
images = np.ones((1, 256, 256, 3))
outputs = efficientnet.predict(images)
# Alternatively, you can also customize the EfficientNetV1 architecture:
model = EfficientNetV1Backbone(
stackwise_kernel_sizes=[3, 3, 5, 3, 5, 5, 3],
stackwise_num_repeats=[1, 2, 2, 3, 3, 4, 1],
stackwise_input_filters=[32, 16, 24, 40, 80, 112, 192],
stackwise_output_filters=[16, 24, 40, 80, 112, 192, 320],
stackwise_expansion_ratios=[1, 6, 6, 6, 6, 6, 6],
stackwise_strides=[1, 2, 2, 2, 1, 2, 1],
stackwise_squeeze_and_excite_ratios=[
0.25,
0.25,
0.25,
0.25,
0.25,
0.25,
0.25,
],
width_coefficient=1.0,
depth_coefficient=1.0,
include_rescaling=False,
)
images = np.ones((1, 256, 256, 3))
outputs = efficientnet.predict(images)
from_preset
methodEfficientNetV1Backbone.from_preset()
Instantiate EfficientNetV1Backbone 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.EfficientNetV1Backbone.from_preset(
"",
)
# Load randomly initialized model from preset architecture with weights
model = keras_cv.models.EfficientNetV1Backbone.from_preset(
"",
load_weights=False,
Preset name | Parameters | Description |
---|---|---|
efficientnetv1_b0 | 4.05M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=1.0 and depth_coefficient=1.0 . |
efficientnetv1_b1 | 6.58M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=1.0 and depth_coefficient=1.1 . |
efficientnetv1_b2 | 7.77M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=1.1 and depth_coefficient=1.2 . |
efficientnetv1_b3 | 10.79M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=1.2 and depth_coefficient=1.4 . |
efficientnetv1_b4 | 17.68M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=1.4 and depth_coefficient=1.8 . |
efficientnetv1_b5 | 28.52M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=1.6 and depth_coefficient=2.2 . |
efficientnetv1_b6 | 40.97M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=1.8 and depth_coefficient=2.6 . |
efficientnetv1_b7 | 64.11M | EfficientNet B-style architecture with 7 convolutional blocks. This B-style model has width_coefficient=2.0 and depth_coefficient=3.1 . |
EfficientNetV1B0Backbone
classkeras_cv.models.EfficientNetV1B0Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B0 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.EfficientNetV1B1Backbone
classkeras_cv.models.EfficientNetV1B1Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B1 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.EfficientNetV1B2Backbone
classkeras_cv.models.EfficientNetV1B2Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B2 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.EfficientNetV1B3Backbone
classkeras_cv.models.EfficientNetV1B3Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B3 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.EfficientNetV1B4Backbone
classkeras_cv.models.EfficientNetV1B4Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B4 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.EfficientNetV1B5Backbone
classkeras_cv.models.EfficientNetV1B5Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B5 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.EfficientNetV1B6Backbone
classkeras_cv.models.EfficientNetV1B6Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B6 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.EfficientNetV1B7Backbone
classkeras_cv.models.EfficientNetV1B7Backbone(
include_rescaling,
width_coefficient,
depth_coefficient,
stackwise_kernel_sizes,
stackwise_num_repeats,
stackwise_input_filters,
stackwise_output_filters,
stackwise_expansion_ratios,
stackwise_strides,
stackwise_squeeze_and_excite_ratios,
dropout_rate=0.2,
drop_connect_rate=0.2,
depth_divisor=8,
input_shape=(None, None, 3),
input_tensor=None,
activation="swish",
**kwargs
)
Instantiates the EfficientNetV1B7 architecture.
Reference
Arguments
True
, inputs will be passed through a Rescaling(1/255.0)
layer.layers.Input()
)
to use as image input for the model.