imgsz warning fix, download function consolidation (#681)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: HaeJin Lee <seareale@gmail.com>
Co-authored-by: Ayush Chaurasia <ayush.chaurarsia@gmail.com>
This commit is contained in:
Glenn Jocher
2023-01-29 02:31:37 +01:00
committed by GitHub
parent 0609561549
commit 899abe9f82
26 changed files with 171 additions and 147 deletions

View File

@ -90,7 +90,7 @@ def get_cfg(cfg: Union[str, Path, Dict, SimpleNamespace] = DEFAULT_CFG, override
# Type checks
for k in 'project', 'name':
if isinstance(cfg[k], (int, float)):
if k in cfg and isinstance(cfg[k], (int, float)):
cfg[k] = str(cfg[k])
# Return instance
@ -176,7 +176,7 @@ def entrypoint(debug=False):
'version': lambda: LOGGER.info(__version__),
'settings': lambda: yaml_print(USER_CONFIG_DIR / 'settings.yaml'),
'cfg': lambda: yaml_print(DEFAULT_CFG_PATH),
'copy-cfg': copy_default_config}
'copy-cfg': copy_default_cfg}
overrides = {} # basic overrides, i.e. imgsz=320
for a in merge_equals_args(args): # merge spaces around '=' sign
@ -221,7 +221,7 @@ def entrypoint(debug=False):
task2data = dict(detect='coco128.yaml', segment='coco128-seg.yaml', classify='mnist160')
# Mode
mode = overrides['mode']
mode = overrides.get('mode', None)
if mode is None:
mode = DEFAULT_CFG.mode or 'predict'
LOGGER.warning(f"WARNING ⚠️ 'mode=' is missing. Valid modes are {modes}. Using default 'mode={mode}'.")
@ -266,7 +266,7 @@ def entrypoint(debug=False):
# Special modes --------------------------------------------------------------------------------------------------------
def copy_default_config():
def copy_default_cfg():
new_file = Path.cwd() / DEFAULT_CFG_PATH.name.replace('.yaml', '_copy.yaml')
shutil.copy2(DEFAULT_CFG_PATH, new_file)
LOGGER.info(f"{PREFIX}{DEFAULT_CFG_PATH} copied to {new_file}\n"