Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add name to MobileNetV3 to allow multiple instances in one model #19695

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion keras/src/applications/mobilenet_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def MobileNetV3(
dropout_rate=0.2,
classifier_activation="softmax",
include_preprocessing=True,
name=None,
):
if not (weights in {"imagenet", None} or file_utils.exists(weights)):
raise ValueError(
Expand Down Expand Up @@ -373,7 +374,7 @@ def MobileNetV3(
inputs = img_input

# Create model.
model = Functional(inputs, x, name="MobilenetV3" + model_type)
model = Functional(inputs, x, name=name)

# Load weights.
if weights == "imagenet":
Expand Down Expand Up @@ -412,6 +413,7 @@ def MobileNetV3Small(
dropout_rate=0.2,
classifier_activation="softmax",
include_preprocessing=True,
name="MobileNetV3Small",
):
def stack_fn(x, kernel, activation, se_ratio):
def depth(d):
Expand Down Expand Up @@ -461,6 +463,7 @@ def depth(d):
dropout_rate,
classifier_activation,
include_preprocessing,
name=name,
)


Expand All @@ -477,6 +480,7 @@ def MobileNetV3Large(
dropout_rate=0.2,
classifier_activation="softmax",
include_preprocessing=True,
name="MobileNetV3Large",
):
def stack_fn(x, kernel, activation, se_ratio):
def depth(d):
Expand Down Expand Up @@ -524,6 +528,7 @@ def depth(d):
dropout_rate,
classifier_activation,
include_preprocessing,
name=name,
)


Expand Down