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

API: Stable default checkpoint #177

Merged
merged 2 commits into from
Jun 25, 2020
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
23 changes: 6 additions & 17 deletions echofilter/inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,7 @@
]
)

# Default checkpoint depends on facing
DEFAULT_CHECKPOINTS = {
"auto": next(iter(CHECKPOINT_RESOURCES)),
"downward": "mobile_effunet6x2-1_lc32_v1.0.ckpt.tar",
"upward": "stationary2_effunet6x2-1_lc32_v1.0.ckpt.tar",
}
DEFAULT_CHECKPOINT = next(iter(CHECKPOINT_RESOURCES))

DEFAULT_VARNAME = "Fileset1: Sv pings T1"
EV_UNDEFINED_DEPTH = -10000.99
Expand Down Expand Up @@ -430,7 +425,7 @@ def run_inference(

if checkpoint is None:
# Use the first item from the list of checkpoints
checkpoint = DEFAULT_CHECKPOINTS[facing]
checkpoint = DEFAULT_CHECKPOINT

ckpt_name = checkpoint

Expand Down Expand Up @@ -2254,18 +2249,12 @@ def __call__(self, parser, namespace, values, option_string):
group_model.add_argument(
"--checkpoint",
type=str,
default=None,
default=DEFAULT_CHECKPOINT,
help="""d|
Name of checkpoint to load, or path to a checkpoint
file. The default checkpoint depends on --facing:
auto : "{auto}"
downward: "{downward}"
upward : "{upward}"
""".format(
auto=DEFAULT_CHECKPOINTS["auto"],
downward=DEFAULT_CHECKPOINTS["downward"],
upward=DEFAULT_CHECKPOINTS["upward"],
),
file.
Default: "%(default)s".
""",
)
group_model.add_argument(
"--unconditioned",
Expand Down