Fix TypeError in check_cfg() (#9245)

Co-authored-by: UltralyticsAssistant <web@ultralytics.com>
Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
zhaoruibing 2024-03-23 08:09:28 -07:00 committed by GitHub
parent 3c179f87cb
commit 528793f452
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -243,7 +243,7 @@ def check_cfg(cfg, hard=True):
f"'{k}={v}' is of invalid type {type(v).__name__}. "
f"Valid '{k}' types are int (i.e. '{k}=0') or float (i.e. '{k}=0.5')"
)
cfg[k] = float(v)
cfg[k] = v = float(v)
if not (0.0 <= v <= 1.0):
raise ValueError(f"'{k}={v}' is an invalid value. " f"Valid '{k}' values are between 0.0 and 1.0.")
elif k in CFG_INT_KEYS and not isinstance(v, int):