From c490723598a07c808cf8f1073e8332d51b747ec6 Mon Sep 17 00:00:00 2001 From: Stijn Vermeeren Date: Wed, 5 Jun 2024 10:46:25 +0200 Subject: [PATCH] improved logging --- src/stratigraphy/main.py | 1 + src/stratigraphy/util/coordinate_extraction.py | 1 + src/stratigraphy/util/draw.py | 1 + 3 files changed, 3 insertions(+) diff --git a/src/stratigraphy/main.py b/src/stratigraphy/main.py index ef2e36b3..54a1b38e 100644 --- a/src/stratigraphy/main.py +++ b/src/stratigraphy/main.py @@ -208,6 +208,7 @@ def start_pipeline( ) mlflow.log_image(img, f"pages/{filename}_page_{page.number + 1}_lines.png") + logger.info("Writing predictions to JSON file %s", predictions_path) with open(predictions_path, "w") as file: file.write(json.dumps(predictions)) diff --git a/src/stratigraphy/util/coordinate_extraction.py b/src/stratigraphy/util/coordinate_extraction.py index 93054525..b1c46058 100644 --- a/src/stratigraphy/util/coordinate_extraction.py +++ b/src/stratigraphy/util/coordinate_extraction.py @@ -295,6 +295,7 @@ def extract_coordinates(self) -> Coordinate | None: if coordinate.is_valid(): return coordinate + if len(coordinate_values): logger.warning(f"Could not extract valid coordinates from {coordinate_values}") logger.info("No coordinates found in this borehole profile.") diff --git a/src/stratigraphy/util/draw.py b/src/stratigraphy/util/draw.py index fab29bc9..9dc2b617 100644 --- a/src/stratigraphy/util/draw.py +++ b/src/stratigraphy/util/draw.py @@ -43,6 +43,7 @@ def draw_predictions(predictions: list[FilePredictions], directory: Path, out_di if directory.is_file(): # deal with the case when we pass a file instead of a directory directory = directory.parent for file_name, file_prediction in predictions.items(): + logger.info("Drawing predictions for file %s", file_name) with fitz.Document(directory / file_name) as doc: for page_index, page in enumerate(doc): page_number = page_index + 1