diff --git a/panoptica/metrics/metrics.py b/panoptica/metrics/metrics.py index c7ce019..57432d7 100644 --- a/panoptica/metrics/metrics.py +++ b/panoptica/metrics/metrics.py @@ -292,9 +292,7 @@ def __init__( self.STD = ( None if self.ALL is None - else empty_list_std - if len(self.ALL) == 0 - else np.std(self.ALL) + else empty_list_std if len(self.ALL) == 0 else np.std(self.ALL) ) def __getitem__(self, mode: MetricMode | str): diff --git a/panoptica/panoptic_evaluator.py b/panoptica/panoptic_evaluator.py index 225930e..2534ad5 100644 --- a/panoptica/panoptic_evaluator.py +++ b/panoptica/panoptic_evaluator.py @@ -21,9 +21,9 @@ class Panoptic_Evaluator: def __init__( self, - expected_input: Type[SemanticPair] - | Type[UnmatchedInstancePair] - | Type[MatchedInstancePair] = MatchedInstancePair, + expected_input: ( + Type[SemanticPair] | Type[UnmatchedInstancePair] | Type[MatchedInstancePair] + ) = MatchedInstancePair, instance_approximator: InstanceApproximator | None = None, instance_matcher: InstanceMatchingAlgorithm | None = None, edge_case_handler: EdgeCaseHandler | None = None, @@ -64,10 +64,9 @@ def __init__( @measure_time def evaluate( self, - processing_pair: SemanticPair - | UnmatchedInstancePair - | MatchedInstancePair - | PanopticaResult, + processing_pair: ( + SemanticPair | UnmatchedInstancePair | MatchedInstancePair | PanopticaResult + ), result_all: bool = True, verbose: bool | None = None, ) -> tuple[PanopticaResult, dict[str, _ProcessingPair]]: @@ -89,10 +88,9 @@ def evaluate( def panoptic_evaluate( - processing_pair: SemanticPair - | UnmatchedInstancePair - | MatchedInstancePair - | PanopticaResult, + processing_pair: ( + SemanticPair | UnmatchedInstancePair | MatchedInstancePair | PanopticaResult + ), instance_approximator: InstanceApproximator | None = None, instance_matcher: InstanceMatchingAlgorithm | None = None, eval_metrics: list[Metric] = [Metric.DSC, Metric.IOU, Metric.ASSD], diff --git a/panoptica/utils/processing_pair.py b/panoptica/utils/processing_pair.py index df1c659..100ff7a 100644 --- a/panoptica/utils/processing_pair.py +++ b/panoptica/utils/processing_pair.py @@ -60,9 +60,13 @@ def crop_data(self, verbose: bool = False): self._prediction_arr = self._prediction_arr[self.crop] self._reference_arr = self._reference_arr[self.crop] - print( - f"-- Cropped from {self.uncropped_shape} to {self._prediction_arr.shape}" - ) if verbose else None + ( + print( + f"-- Cropped from {self.uncropped_shape} to {self._prediction_arr.shape}" + ) + if verbose + else None + ) self.is_cropped = True def uncrop_data(self, verbose: bool = False): @@ -77,9 +81,13 @@ def uncrop_data(self, verbose: bool = False): reference_arr = np.zeros(self.uncropped_shape) reference_arr[self.crop] = self._reference_arr - print( - f"-- Uncropped from {self._reference_arr.shape} to {self.uncropped_shape}" - ) if verbose else None + ( + print( + f"-- Uncropped from {self._reference_arr.shape} to {self.uncropped_shape}" + ) + if verbose + else None + ) self._reference_arr = reference_arr self.is_cropped = False