Skip to content

Commit ad032dd

Browse files
SangdaeNameunwoosh
authored andcommitted
[HPO] Enabling ote_anomalib to report score for hpopt
1 parent f003a20 commit ad032dd

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

external/anomaly/ote_anomalib/callbacks/progress.py

+9
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ def _get_progress(self, stage: str = "train") -> float:
112112
raise ValueError(f"Unknown stage {stage}. Available: train, predict and test")
113113

114114
return self._progress
115+
116+
def on_validation_epoch_end(self, trainer, pl_module):
117+
super().on_validation_epoch_end(trainer, pl_module)
118+
score = None
119+
metric = self.update_progress_callback.metric if hasattr(self.update_progress_callback, 'metric') else None
120+
if metric in list(trainer.logged_metrics.keys()):
121+
score = float(trainer.logged_metrics[metric])
122+
progress = int(self._get_progress('predict'))
123+
self.update_progress_callback(progress=progress, score=score)
115124

116125
def _update_progress(self, stage: str):
117126
progress = self._get_progress(stage)

0 commit comments

Comments
 (0)