Skip to content

Commit

Permalink
enable visualisation without ground truth for that file
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnvermeeren-swisstopo committed Jun 3, 2024
1 parent 6dedc85 commit 6381102
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/stratigraphy/benchmark/ground_truth.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ def __init__(self, path: Path):
metadata = ground_truth_item["metadata"]
self.ground_truth[borehole_profile]["metadata"] = metadata

def for_file(self, file_name: str) -> list:
def for_file(self, file_name: str) -> dict:
if file_name in self.ground_truth:
return self.ground_truth[file_name]
else:
logger.warning(f"No ground truth data found for {file_name}.")
return []
return {}
6 changes: 4 additions & 2 deletions src/stratigraphy/benchmark/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,8 +275,10 @@ def create_predictions_objects(predictions: dict, ground_truth_path: Path) -> tu

predictions_objects[file_name] = prediction_object
if ground_truth_is_present:
predictions_objects[file_name].evaluate(ground_truth.for_file(file_name))
number_of_truth_values[file_name] = len(ground_truth.for_file(file_name)["layers"])
ground_truth_for_file = ground_truth.for_file(file_name)
if ground_truth_for_file:
predictions_objects[file_name].evaluate(ground_truth_for_file)
number_of_truth_values[file_name] = len(ground_truth_for_file["layers"])

return predictions_objects, number_of_truth_values

Expand Down

0 comments on commit 6381102

Please sign in to comment.