EfficientNetV1Backbone
类keras_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
)
实例化 EfficientNetV1 架构。
参考
参数
Rescaling(1/255.0)
层。keras.keras.layers.Input()
的输出),用作模型的图像输入。示例
# 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
方法EfficientNetV1Backbone.from_preset()
从预设配置和权重实例化 EfficientNetV1Backbone 模型。
参数
None
,这取决于预设是否有可用的预训练权重。示例
# 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,
预设名称 | 参数 | 描述 |
---|---|---|
efficientnetv1_b0 | 4.05M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=1.0 和 depth_coefficient=1.0 。 |
efficientnetv1_b1 | 6.58M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=1.0 和 depth_coefficient=1.1 。 |
efficientnetv1_b2 | 7.77M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=1.1 和 depth_coefficient=1.2 。 |
efficientnetv1_b3 | 10.79M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=1.2 和 depth_coefficient=1.4 。 |
efficientnetv1_b4 | 17.68M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=1.4 和 depth_coefficient=1.8 。 |
efficientnetv1_b5 | 28.52M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=1.6 和 depth_coefficient=2.2 。 |
efficientnetv1_b6 | 40.97M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=1.8 和 depth_coefficient=2.6 。 |
efficientnetv1_b7 | 64.11M | 具有 7 个卷积块的 EfficientNet B 风格架构。此 B 风格模型具有 width_coefficient=2.0 和 depth_coefficient=3.1 。 |
EfficientNetV1B0Backbone
类keras_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
)
实例化 EfficientNetV1B0 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。EfficientNetV1B1Backbone
类keras_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
)
实例化 EfficientNetV1B1 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。EfficientNetV1B2Backbone
类keras_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
)
实例化 EfficientNetV1B2 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。EfficientNetV1B3Backbone
类keras_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
)
实例化 EfficientNetV1B3 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。EfficientNetV1B4Backbone
类keras_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
)
实例化 EfficientNetV1B4 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。EfficientNetV1B5Backbone
类keras_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
)
实例化 EfficientNetV1B5 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。EfficientNetV1B6Backbone
类keras_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
)
实例化 EfficientNetV1B6 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。EfficientNetV1B7Backbone
类keras_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
)
实例化 EfficientNetV1B7 架构。
参考
参数
True
,则输入将通过 Rescaling(1/255.0)
层。layers.Input()
的输出),用作模型的图像输入。