Esempio n. 1
0
    # model_path = 'thibault_model2/'
    # model_name = 'cnn_gpu.model'
    # size = 50
    # model = nn.CNN_thibault()

    # model_path = 'thibault_model3/'
    # model_name = 'cnn_gpu.model'
    # size = 50
    # model = nn.CNN_thibault()

    model_path = 'thibault_model5/'
    model_name = 'cnn_gpu.model'
    size = 50
    model = nn.CNN_thibault2()

    # model_path = 'thibault_model6/'
    # model_name = 'cnn_gpu.model'
    # size = 50
    # model = nn.CNN_thibault()

    serializers.load_npz(model_path + model_name, model)
    optimizer = chainer.optimizers.Adam()
    optimizer.setup(model)

    Xts, Yts = ld.load_test_dataset(test_N)
    Ye = validation(size, model, Xts, Yts)

    v.loss_visualizer(model_path)
    plt.show()
Esempio n. 2
0
    trainer.extend(extensions.LogReport())

    # Print selected entries of the log to stdout
    # Here "main" refers to the target link of the "main" optimizer again, and
    # "validation" refers to the default name of the Evaluator extension.
    # Entries other than 'epoch' are reported by the Classifier link, called by
    # either the updater or the evaluator.
    trainer.extend(
        extensions.PrintReport([
            'epoch', 'main/loss', 'validation/main/loss', 'main/accuracy',
            'validation/main/accuracy'
        ]))

    # Print a progress bar to stdout
    trainer.extend(extensions.ProgressBar())

    start_time = time.time()  #start time measurement

    # Run the training
    trainer.run()

    execution_time = time.time() - start_time
    print "execution time : " + str(execution_time)

    print('saved the model')
    serializers.save_npz('cnn.model', model)
    print('saved the optimizer')
    serializers.save_npz('cnn.state', optimizer)

    v.loss_visualizer()