From 1df6af2acb1abb3494708bfe6752f94e3e4b98aa Mon Sep 17 00:00:00 2001 From: "Daniel.Frisinghelli" <daniel.frisinghelli@eurac.edu> Date: Thu, 4 Feb 2021 17:35:47 +0100 Subject: [PATCH] Improved logging. --- pysegcnn/core/graphics.py | 2 +- pysegcnn/core/models.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pysegcnn/core/graphics.py b/pysegcnn/core/graphics.py index 82badfc..2eeaa30 100644 --- a/pysegcnn/core/graphics.py +++ b/pysegcnn/core/graphics.py @@ -481,7 +481,7 @@ def plot_loss(state_file, figsize=(10, 10), step=5, # load the model state state_file = pathlib.Path(state_file) model_state = torch.load(state_file) - LOGGER.info('Plot model statistics: {}'.format(state_file.stem)) + LOGGER.info('Plot model statistics: {}'.format(state_file.name)) # get all non-zero elements, i.e. get number of epochs trained before # early stop diff --git a/pysegcnn/core/models.py b/pysegcnn/core/models.py index d37daca..3070393 100644 --- a/pysegcnn/core/models.py +++ b/pysegcnn/core/models.py @@ -197,7 +197,6 @@ class Network(nn.Module): state_file = pathlib.Path(check_filename_length(state_file)) if not state_file.exists(): raise FileNotFoundError('{} does not exist.'.format(state_file)) - LOGGER.info('Loading pretrained weights from: {}'.format(state_file)) # load the model state model_state = torch.load(state_file) @@ -285,6 +284,8 @@ class Network(nn.Module): SupportedOptimizers) # load the pretrained model configuration + LOGGER.info('Loading pretrained weights from: {}' + .format(state_file.name)) model_state = Network.load(state_file) # instanciate the pretrained model architecture -- GitLab