Skip to content

Commit

Permalink
use logger name
Browse files Browse the repository at this point in the history
  • Loading branch information
bw4sz committed Feb 8, 2025
1 parent f420f6a commit 71adaf8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/reporting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from src.visualization import PredictionVisualizer
from src.detection import predict
import geopandas as gpd
from pytorch_lightning.loggers import CometLogger
import glob

class Reporting:
Expand Down Expand Up @@ -41,8 +42,8 @@ def __init__(self, report_dir, image_dir, metadata_csv, pipeline_monitor=None, m
self.confident_predictions = confident_predictions
self.metadata = metadata_csv

self.detection_experiment = model.trainer.logger.experiment
self.classification_experiment = classification_model.trainer.logger.experiment
self.detection_experiment = model.trainer.logger
self.classification_experiment = classification_model.trainer.logger

# Check the dirs exist
os.makedirs(self.report_dir, exist_ok=True)
Expand Down Expand Up @@ -172,19 +173,14 @@ def write_metrics(self):
}

# If comet logger exists add model evaluation urls
try:
if type(self.detection_experiment) == CometLogger:
report_data['detection_model_url'] = self.detection_experiment.url
for metric in self.detection_experiment.metrics:
report_data[f"detection_{metric}"] = self.detection_experiment.metrics[metric]
except AttributeError:
report_data['detection_model_url'] = None

try:
report_data['classification_model_url'] = self.classification_experiment.url
for metric in self.classification_experiment.metrics:
report_data[f"classification_{metric}"] = self.classification_experiment.metrics[metric]
except AttributeError:
report_data['classification_model_url'] = None

# Load existing or create new report file
if os.path.exists(self.report_file):
Expand Down

0 comments on commit 71adaf8

Please sign in to comment.