MobileNetV3Backbone
類別keras_cv.models.MobileNetV3Backbone(
stackwise_expansion,
stackwise_filters,
stackwise_kernel_size,
stackwise_stride,
stackwise_se_ratio,
stackwise_activation,
include_rescaling,
input_shape=(None, None, 3),
input_tensor=None,
alpha=1.0,
**kwargs
)
實例化 MobileNetV3 架構。
參考資料
對於遷移學習用例,請務必閱讀遷移學習和微調指南。
參數
Rescaling(scale=1 / 255)
層。layers.Input()
的輸出),用作模型的圖像輸入。alpha
< 1.0,則按比例減少每一層中的過濾器數量。alpha
> 1.0,則按比例增加每一層中的過濾器數量。alpha
= 1,則在每一層使用論文中的預設過濾器數量。範例
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone with a custom config
model = MobileNetV3Backbone(
stackwise_expansion=[1, 72.0 / 16, 88.0 / 24, 4, 6, 6, 3, 3, 6, 6, 6],
stackwise_filters=[16, 24, 24, 40, 40, 40, 48, 48, 96, 96, 96],
stackwise_kernel_size=[3, 3, 3, 5, 5, 5, 5, 5, 5, 5, 5],
stackwise_stride=[2, 2, 1, 2, 1, 1, 1, 1, 2, 1, 1],
stackwise_se_ratio=[0.25, None, None, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25, 0.25],
stackwise_activation=["relu", "relu", "relu", "hard_swish", "hard_swish", "hard_swish", "hard_swish", "hard_swish", "hard_swish", "hard_swish", "hard_swish"],
include_rescaling=False,
)
output = model(input_data)
from_preset
方法MobileNetV3Backbone.from_preset()
從預設配置和權重實例化 MobileNetV3Backbone 模型。
參數
None
,這取決於預設配置是否有可用的預先訓練權重。範例
# Load architecture and weights from preset
model = keras_cv.models.MobileNetV3Backbone.from_preset(
"mobilenet_v3_large_imagenet",
)
# Load randomly initialized model from preset architecture with weights
model = keras_cv.models.MobileNetV3Backbone.from_preset(
"mobilenet_v3_large_imagenet",
load_weights=False,
預設名稱 | 參數 | 說明 |
---|---|---|
mobilenet_v3_small | 933.50K | 具有 14 層的 MobileNetV3 模型,在卷積層後應用批次標準化和硬性 swish 激活函數。 |
mobilenet_v3_large | 2.99M | 具有 28 層的 MobileNetV3 模型,在卷積層後應用批次標準化和硬性 swish 激活函數。 |
mobilenet_v3_large_imagenet | 2.99M | 具有 28 層的 MobileNetV3 模型,在卷積層後應用批次標準化和硬性 swish 激活函數。在 ImageNet 2012 分類任務上進行了預先訓練。 |
mobilenet_v3_small_imagenet | 933.50K | 具有 14 層的 MobileNetV3 模型,在卷積層後應用批次標準化和硬性 swish 激活函數。在 ImageNet 2012 分類任務上進行了預先訓練。 |
MobileNetV3SmallBackbone
類別keras_cv.models.MobileNetV3SmallBackbone(
stackwise_expansion,
stackwise_filters,
stackwise_kernel_size,
stackwise_stride,
stackwise_se_ratio,
stackwise_activation,
include_rescaling,
input_shape=(None, None, 3),
input_tensor=None,
alpha=1.0,
**kwargs
)
具有 14 層的 MobileNetV3Backbone 模型。
參考資料
對於遷移學習用例,請務必閱讀遷移學習和微調指南。
參數
Rescaling(scale=1 / 255)
層。預設值為 True。layers.Input()
的輸出),用作模型的圖像輸入。範例
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone
model = MobileNetV3SmallBackbone()
output = model(input_data)
MobileNetV3LargeBackbone
類別keras_cv.models.MobileNetV3LargeBackbone(
stackwise_expansion,
stackwise_filters,
stackwise_kernel_size,
stackwise_stride,
stackwise_se_ratio,
stackwise_activation,
include_rescaling,
input_shape=(None, None, 3),
input_tensor=None,
alpha=1.0,
**kwargs
)
具有 28 層的 MobileNetV3Backbone 模型。
參考資料
對於遷移學習用例,請務必閱讀遷移學習和微調指南。
參數
Rescaling(scale=1 / 255)
層。預設值為 True。layers.Input()
的輸出),用作模型的圖像輸入。範例
input_data = tf.ones(shape=(8, 224, 224, 3))
# Randomly initialized backbone
model = MobileNetV3LargeBackbone()
output = model(input_data)