diff --git a/panoptica/panoptic_evaluator.py b/panoptica/panoptic_evaluator.py index 1daeda9..9f60481 100644 --- a/panoptica/panoptic_evaluator.py +++ b/panoptica/panoptic_evaluator.py @@ -82,7 +82,8 @@ def evaluate( decision_threshold=self.__decision_threshold, result_all=result_all, log_times=self.__log_times, - verbose=self.__verbose if verbose is None else verbose, + verbose=True if verbose is None else verbose, + verbose_calc=self.__verbose if verbose is None else verbose, ) @@ -98,7 +99,8 @@ def panoptic_evaluate( edge_case_handler: EdgeCaseHandler | None = None, log_times: bool = False, result_all: bool = True, - verbose: bool = False, + verbose=False, + verbose_calc=False, **kwargs, ) -> tuple[PanopticaResult, dict[str, _ProcessingPair]]: """ @@ -128,14 +130,16 @@ def panoptic_evaluate( >>> panoptic_evaluate(SemanticPair(...), instance_approximator=InstanceApproximator(), iou_threshold=0.6) (PanopticaResult(...), {'UnmatchedInstanceMap': _ProcessingPair(...), 'MatchedInstanceMap': _ProcessingPair(...)}) """ - print("Panoptic: Start Evaluation") + if verbose: + print("Panoptic: Start Evaluation") if edge_case_handler is None: # use default edgecase handler edge_case_handler = EdgeCaseHandler() debug_data: dict[str, _ProcessingPair] = {} # First Phase: Instance Approximation if isinstance(processing_pair, PanopticaResult): - print("-- Input was Panoptic Result, will just return") + if verbose: + print("-- Input was Panoptic Result, will just return") return processing_pair, debug_data # Crops away unecessary space of zeroes @@ -145,7 +149,8 @@ def panoptic_evaluate( assert ( instance_approximator is not None ), "Got SemanticPair but not InstanceApproximator" - print("-- Got SemanticPair, will approximate instances") + if verbose: + print("-- Got SemanticPair, will approximate instances") start = perf_counter() processing_pair = instance_approximator.approximate_instances(processing_pair) if log_times: @@ -161,7 +166,8 @@ def panoptic_evaluate( ) if isinstance(processing_pair, UnmatchedInstancePair): - print("-- Got UnmatchedInstancePair, will match instances") + if verbose: + print("-- Got UnmatchedInstancePair, will match instances") assert ( instance_matcher is not None ), "Got UnmatchedInstancePair but not InstanceMatchingAlgorithm" @@ -183,7 +189,8 @@ def panoptic_evaluate( ) if isinstance(processing_pair, MatchedInstancePair): - print("-- Got MatchedInstancePair, will evaluate instances") + if verbose: + print("-- Got MatchedInstancePair, will evaluate instances") start = perf_counter() processing_pair = evaluate_matched_instance( processing_pair, @@ -197,7 +204,7 @@ def panoptic_evaluate( if isinstance(processing_pair, PanopticaResult): if result_all: - processing_pair.calculate_all(print_errors=verbose) + processing_pair.calculate_all(print_errors=verbose_calc) return processing_pair, debug_data raise RuntimeError("End of panoptic pipeline reached without results") diff --git a/panoptica/timing.py b/panoptica/timing.py index dbee75a..965df51 100644 --- a/panoptica/timing.py +++ b/panoptica/timing.py @@ -9,7 +9,8 @@ def wrapper(*args, **kwargs): result = func(*args, **kwargs) end_time = time.time() elapsed_time = end_time - start_time - print(f"-- {func.__name__} took {elapsed_time} seconds to execute.") + if hasattr(kwargs, "verbose") and getattr(kwargs, "verbose"): + print(f"-- {func.__name__} took {elapsed_time} seconds to execute.") return result return wrapper diff --git a/panoptica/utils/citation_reminder.py b/panoptica/utils/citation_reminder.py index 92cd262..8671bd8 100644 --- a/panoptica/utils/citation_reminder.py +++ b/panoptica/utils/citation_reminder.py @@ -13,7 +13,7 @@ def wrapper(*args, **kwargs): console = Console() console.rule("Thank you for using [bold]panoptica[/bold]") console.print( - f"Please support our development by citing", + "Please support our development by citing", justify="center", ) console.print( @@ -22,6 +22,7 @@ def wrapper(*args, **kwargs): ) console.rule() console.line() + os.environ["PANOPTICA_CITATION_REMINDER"] = "false" # Show only once return func(*args, **kwargs) return wrapper