Skip to content

Commit

Permalink
Merge branch 'dev' into feature/segmentation-ddrnet
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlov721 committed Sep 19, 2024
2 parents 3cd7c7a + 7daabdc commit 3a1891b
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions luxonis_train/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,28 +82,6 @@ class ModelConfig(BaseModelExtraForbid):
visualizers: list[AttachedModuleConfig] = []
outputs: list[str] = []

@model_validator(mode="after")
def check_main_metric(self) -> Self:
for metric in self.metrics:
if metric.is_main_metric:
logger.info(f"Main metric: `{metric.name}`")
return self

logger.warning("No main metric specified.")
if self.metrics:
metric = self.metrics[0]
metric.is_main_metric = True
name = metric.alias or metric.name
logger.info(f"Setting '{name}' as main metric.")
else:
logger.warning(
"[Ignore if using predefined model] "
"No metrics specified. "
"This is likely unintended unless "
"the configuration is not used for training. "
)
return self

@model_validator(mode="after")
def check_predefined_model(self) -> Self:
from luxonis_train.utils.registry import MODELS
Expand All @@ -128,6 +106,28 @@ def check_predefined_model(self) -> Self:

return self

@model_validator(mode="after")
def check_main_metric(self) -> Self:
for metric in self.metrics:
if metric.is_main_metric:
logger.info(f"Main metric: `{metric.name}`")
return self

logger.warning("No main metric specified.")
if self.metrics:
metric = self.metrics[0]
metric.is_main_metric = True
name = metric.alias or metric.name
logger.info(f"Setting '{name}' as main metric.")
else:
logger.warning(
"[Ignore if using predefined model] "
"No metrics specified. "
"This is likely unintended unless "
"the configuration is not used for training. "
)
return self

@model_validator(mode="after")
def check_graph(self) -> Self:
from luxonis_train.utils import is_acyclic
Expand Down

0 comments on commit 3a1891b

Please sign in to comment.