epoch += 1

        if epoch > options['num_epochs']:
            train_complete = True
            training = False

        # Load latest best model
    lesion_model.load_state_dict(torch.load(jp(path_models, "checkpoint.pt")))
except KeyboardInterrupt:
    # If training is stopped, load last model
    print("Training was stopped, loading last model...")
    lesion_model.load_state_dict(torch.load(jp(path_models, "checkpoint.pt")))

    plot_learning_curve(train_losses,
                        val_losses,
                        the_title="Learning curve",
                        measure="Loss (" + options["loss"] + ")",
                        early_stopping=True,
                        filename=jp(path_results, "loss_plot.png"))
    plot_learning_curve(train_jaccs,
                        val_jaccs,
                        the_title="Jaccard plot",
                        measure="Jaccard",
                        early_stopping=False,
                        filename=jp(path_results, "jaccard_plot.png"))

options['max_epoch_reached'] = epoch

#plot_learning_curve(train_losses, val_losses, the_title="Learning curve", measure = "Loss (" + options["loss"] + ")", early_stopping = True, filename = jp(path_results, "loss_plot.png"))
#plot_learning_curve(train_jaccs, val_jaccs, the_title="Jaccard plot", measure = "Jaccard", early_stopping = False, filename = jp(path_results, "jaccard_plot.png"))

#Plot learning curve
Example #2
0
        epoch += 1

        if epoch > options['num_epochs']:
            train_complete = True
            training = False

        # Load latest best model
    lesion_model.load_state_dict(torch.load(jp(path_models, "checkpoint.pt")))
except KeyboardInterrupt:
    # If training is stopped, load last model
    print("Training was stopped, loading last model...")
    lesion_model.load_state_dict(torch.load(jp(path_models, "checkpoint.pt")))

    plot_learning_curve(train_losses,
                        val_losses,
                        the_title="Learning curve",
                        measure="Loss (" + options["loss"] + ")",
                        early_stopping=True,
                        filename=jp(path_results, "loss_plot.png"))
    #plot_learning_curve(train_jaccs, val_jaccs, the_title="Jaccard plot", measure = "Jaccard", early_stopping = False, filename = jp(path_results, "jaccard_plot.png"))
    plot_learning_curve(train_accs,
                        val_accs,
                        the_title="Accuracy plot",
                        measure="Accuraca",
                        early_stopping=False,
                        filename=jp(path_results, "acc_plot.png"))

options['max_epoch_reached'] = epoch

#Plot learning curve
if train_complete:
    plot_learning_curve(train_losses,