Skip to content

Commit

Permalink
fine-grained metrics, skip objective
Browse files Browse the repository at this point in the history
- fixes #82
  • Loading branch information
casperdcl committed Sep 13, 2024
1 parent 55d009b commit 8a41f57
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions petric.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Callback(cil_callbacks.Callback):
CIL Callback but with `self.skip_iteration` checking `min(self.interval, algo.update_objective_interval)`.
TODO: backport this class to CIL.
"""
def __init__(self, interval: int = 1 << 31, **kwargs):
def __init__(self, interval: int = 1, **kwargs):
super().__init__(**kwargs)
self.interval = interval

Expand Down Expand Up @@ -110,7 +110,7 @@ def __call__(self, algo: Algorithm):

class QualityMetrics(ImageQualityCallback, Callback):
"""From https://github.com/SyneRBI/PETRIC/wiki#metrics-and-thresholds"""
def __init__(self, reference_image, whole_object_mask, background_mask, interval: int = 1 << 31, **kwargs):
def __init__(self, reference_image, whole_object_mask, background_mask, interval: int = 1, **kwargs):
# TODO: drop multiple inheritance once `interval` included in CIL
Callback.__init__(self, interval=interval)
ImageQualityCallback.__init__(self, reference_image, **kwargs)
Expand Down Expand Up @@ -297,7 +297,7 @@ def get_image(fname):
metrics_with_timeout.reset() # timeout from now
algo = Submission(data)
try:
algo.run(np.inf, callbacks=metrics + submission_callbacks)
algo.run(np.inf, callbacks=metrics + submission_callbacks, update_objective_interval=np.inf)
except Exception:
print_exc(limit=2)
finally:
Expand Down

0 comments on commit 8a41f57

Please sign in to comment.