def autoencoder_subtask_deep_fashion():
    # train AET with DeepFashion
    encoder_trained, losses = train_autoencoder_deep_fashion()
    plot_n_curves(losses,
                  "Train losses",
                  "Loss training autoencoder DeepFashion",
                  axis2="Loss")

    # transfer learning with DeepFashion
    encoder_ft, train_losses, val_losses, train_acc, val_acc = fine_tune_autoencoder_deep_fashion(
        encoder_trained)

    # test with DeepFashion
    average_test_loss, average_test_accuracy = test_autoencoder_deep_fashion(
        encoder_ft)
    plot_summary([train_acc, val_acc],
                 average_test_accuracy,
                 ["train accuracy", "val accuracy", "test accuracy"],
                 "Accuracy autoencoder DeepFashion",
                 axis2="Accuracy")
    plot_summary([train_losses, val_losses],
                 average_test_loss,
                 ["train loss", "val loss", "test average loss"],
                 "Loss autoencoder DeepFashion",
                 axis2="Loss")

    return average_test_loss, average_test_accuracy
Example #2
0
def autoencoder_subtask_fashion_mnist():
    # train autoencoder with FashionMNIST
    encoder_trained, losses = train_autoencoder_mnist()
    plot_n_curves(losses,
                  "Train losses",
                  "Loss train autoencoder Fashion MNIST",
                  axis2="Loss")

    # transfer learning with FashionMNIST
    encoder_ft, train_losses, val_losses, train_acc, val_acc = fine_tune_autoencoder_mnist(
        encoder_trained)

    # test with FashionMNIST
    average_test_loss, average_test_accuracy = test_autoencoder_mnist(
        encoder_ft)
    plot_summary([train_acc, val_acc],
                 average_test_accuracy,
                 ["train accuracy", "val accuracy", "test accuracy"],
                 "Accuracy test autoencoder FashionMNIST",
                 axis2="Accuracy")
    plot_summary([train_losses, val_losses],
                 average_test_loss,
                 ["train loss", "val loss", "test average loss"],
                 "Loss test autoencoder FashionMNIST",
                 axis2="Loss")
    return average_test_loss, average_test_accuracy
Example #3
0
def exemplar_cnn_subtask_deep_fashion():
    # train exemplar cnn with DeepFashion
    ex_cnn_trained, losses, accuracies = train_exemplar_cnn_deep_fashion()
    plot_n_curves([losses], ["train loss"],
                  "Loss train ExemplarCNN DeepFashion",
                  axis2="Loss")
    plot_n_curves([accuracies], ["train accuracy"],
                  "Accuracy train ExemplarCNN DeepFashion",
                  axis2="Accuracy")

    # fine tune exemplar cnn with DeepFashion
    ex_cnn_finetuned, train_losses, val_losses, train_acc, val_acc = fine_tune_exemplar_cnn_deep_fashion(
        ex_cnn_trained)

    # test with DeepFashion
    average_test_loss, average_test_accuracy = test_classification_on_exemplar_cnn_deep_fashion(
        ex_cnn_finetuned)
    plot_summary([train_acc, val_acc],
                 average_test_accuracy,
                 ["train accuracy", "val accuracy", "test accuracy"],
                 "Accuracy Test ExemplarCNN Deep Fashion",
                 axis2="Accuracy")
    plot_summary([train_losses, val_losses],
                 average_test_loss, ["train loss", "val loss", "test loss"],
                 "Loss Test ExemplarCNN Deep Fashion",
                 axis2="Loss")

    return average_test_loss, average_test_accuracy
def rotation_subtask_fashion_mnist():
    # train rotation net with FashionMNIST
    rotnet_trained, train_losses, val_losses, train_acc, val_acc = train_rotation_net(
    )
    plot_n_curves([train_losses, val_losses], ["train loss", "val loss"],
                  "Loss rotation FashionMNIST",
                  axis2="Loss")
    plot_n_curves([train_acc, val_acc], ["train accuracy", "val accuracy"],
                  "Accuracy rotation FashionMNIST",
                  axis2="Accuracy")

    # fine tune rotation net with FashionMNIST
    rotnet_ft, train_losses_ft, val_losses_ft, train_acc_ft, val_acc_ft = fine_tune_rotation_model(
        rotnet_trained)

    # test with FashionMNIST
    average_test_loss, average_test_accuracy = test_classification_on_rotation_model(
        rotnet_ft)
    plot_summary([train_acc_ft, val_acc_ft],
                 average_test_accuracy,
                 ["train accuracy", "val accuracy", "test accuracy"],
                 "Accuracy Test Rotation FashionMNIST",
                 axis2="Accuracy")
    plot_summary([train_losses_ft, val_losses_ft],
                 average_test_loss, ["train loss", "val loss", "test loss"],
                 "Loss Test Rotation FashionMNIST",
                 axis2="Loss")

    return average_test_loss, average_test_accuracy