ashpy icon indicating copy to clipboard operation
ashpy copied to clipboard

[BUG/PERFORMANCE] - Handling of logdir: conflict between metrics and trainer

Open EmanueleGhelfi opened this issue 4 years ago • 0 comments

The logdir can be defined in trainers and in metrics.

The actual behaviour is to override the metric's logdir using the trainer's logdir.

However, the logdir parameter in trainer is optional and it has a default value (cwd + "log").


logdir = "mylogdir"

precision = ClassifierMetric(
            metric=tf.keras.metrics.Precision(),
            model_selection_operator=operator.gt,
            logdir=logdir,
)

trainer = ClassifierTrainer(
            model=self.model,
            optimizer=optimizer,
            loss=loss,
            epochs=epochs,
            metrics=[precision], 
            callbacks=callbacks,
)
 trainer(
            self.train_dataset.batch(batch_size).prefetch(1),
            self.validation_dataset.batch(batch_size).prefetch(1),
)

Ashpy logs in the directory "log" instead of the directory "mylogdir".

Possible solution: remove logdir from the metric's __init__ and set the logdir from the trainer.

[Optional] remove logdir default values.

EmanueleGhelfi avatar May 07 '20 06:05 EmanueleGhelfi