Skip to content

Commit

Permalink
Autoformat with black
Browse files Browse the repository at this point in the history
  • Loading branch information
brainless-bot[bot] committed Feb 1, 2024
1 parent 5b2caf1 commit dbf9d0b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 20 deletions.
4 changes: 1 addition & 3 deletions panoptica/metrics/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
20 changes: 9 additions & 11 deletions panoptica/panoptic_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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]]:
Expand All @@ -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],
Expand Down
20 changes: 14 additions & 6 deletions panoptica/utils/processing_pair.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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

Expand Down

0 comments on commit dbf9d0b

Please sign in to comment.