Skip to content

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrykin committed Mar 10, 2024
1 parent 4705c96 commit 15734c3
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions segmetrics/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ def __init__(self, aggregation: str = 'mean'):
'geometric-mean',
'object-mean',
)
self.aggregation: str = aggregation
self._aggregation: str = aggregation

@property
def aggregation(self) -> str:
return self._aggregation

def set_expected(self, expected: LabelImage) -> None:
self.expected = expected
Expand Down Expand Up @@ -160,9 +164,8 @@ def __init__(
correspondance_function: Callable[[List[float]], float],
**kwargs
):
super().__init__(**kwargs)
super().__init__(aggregation=measure.aggregation, **kwargs)
self.measure = measure
self.aggregation = measure.aggregation
self.nodetections = -1 # value to be used if detections are empty
self.correspondance_function = correspondance_function

Expand Down Expand Up @@ -223,9 +226,8 @@ def default_name(self):
class ReverseMeasureAdapter(Measure):

def __init__(self, measure: MeasureProtocol, **kwargs):
super().__init__(**kwargs)
self.measure = measure
self.aggregation = measure.aggregation
super().__init__(aggregation=measure.aggregation, **kwargs)
self.measure = measure

def compute(self, actual: LabelImage) -> List[float]:
self.measure.set_expected(actual)
Expand All @@ -243,11 +245,10 @@ def __init__(
measure2: MeasureProtocol,
**kwargs,
):
super().__init__(**kwargs)
super().__init__(aggregation=measure1.aggregation, **kwargs)
assert measure1.aggregation == measure2.aggregation
self.measure1 = measure1
self.measure2 = measure2
self.aggregation = measure1.aggregation
self.measure1 = measure1
self.measure2 = measure2

def set_expected(self, expected: LabelImage) -> None:
self.measure1.set_expected(expected)
Expand Down

0 comments on commit 15734c3

Please sign in to comment.