Ejemplo n.º 1
0
if args.resume:
    # Resume from a snapshot
    chainer.serializers.load_npz(args.resume, trainer)

# Get confusion matrix picture before training:
log_confusion_matrix(experiment, model, trainer, 0, 0)

# Run the training
trainer.run()

# Report created images to comet.ml:
## If you want to include a graph made by chainer, you can:
#if args.plot and extensions.PlotReport.available():
#    experiment.log_image('result/loss.png')
#    experiment.log_image('result/accuracy.png')

# Report the graph, as dot language:
(graph, ) = pydot.graph_from_dot_file('result/cg.dot')
graph.write_png('result/cg.png')
experiment.log_image('result/cg.png')
with open("result/cg.dot") as fp:
    desc = fp.readlines()
    experiment.set_model_graph("\n".join(desc))

# Report a URL:
experiment.log_html_url(
    "https://github.com/chainer/chainer/"
    "blob/master/examples/mnist/train_mnist.py",
    label="This MNIST example is based on")