Skip to content

Integration with PyCaffe (Using Step)

This topic shows you how to integrate the MissingLink SDK with a PyCaffe LeNet network that is trained on the MNIST dataset.

The following steps are covered:

  • Define a project callback with your credentials.
  • Create a new experiment.
  • Give the experiment a name and description.
  • Use MissingLink's PyCaffeCallback to create a wrapped SGDSolver.

Note

You can also consider trying the step-by-step tutorial for integrating the MissingLink SDK with an existing PyCaffe example.

Preparation

  • You must have Caffe installed in the same working environment that MissingLink SDK is installed. The SDK doesn't enforce Caffe as one of its dependencies.

  • You must have created a new project and have its credentials: owner_id and project_token ready. Otherwise, follow the instructions in Creating a project.

Note

Ensure that you can successfully run the basic mnist.py training script. In the steps that follow below, the basic script is integrated with the MissingLink SDK to enable remote monitoring of the training, validation, and testing process.

Compare the basic script with the integrated script.

Write code

  1. Import the SDK and define your credentials at the beginning of the file (before any function definition).

    import missinglink
    
    OWNER_ID = 'Your owner id'
    PROJECT_TOKEN = 'Your project token'
    
  2. Create a PyCaffeCallback instance with your credentials. This helps to monitor the experiment in real time. Add the following statement before creating a solver:

    missinglink_callback = missinglink.PyCaffeCallback(
        OWNER_ID, PROJECT_TOKEN)
    
  3. Give the experiment a name and description by adding the following statement right after creating the MissingLink's PyCaffeCallback.

    missinglink_callback.set_properties(
        display_name='MNIST', description='LeNet network')
    
  4. Next, instead of creating an original caffe solver, use the callback to create a wrapped solver. Modify the original solver creation statement with this statement:

    solver = missinglink_callback.create_wrapped_solver(
        caffe.SGDSolver, 'mnist/lenet_auto_solver.prototxt')
    

    You can find the full, updated script here.

  5. Use the created solver to step through the required number of iterations.

    solver = missinglink_callback.create_wrapped_solver(
        caffe.SGDSolver, 'mnist/lenet_auto_solver.prototxt')
    
    ITERATIONS = 1000
    
    for i in range(ITERATIONS):
        solver.step(1)
    

Important

The SDK automatically collects the validation metrics on each test interval.

To track validation metrics, use the test_interval configuration.


You should have integrated MissingLink's SDK successfully.

  • Inspect the resulting integrated script.
  • Run the new script and see how the MissingLink.ai dashboard helps with monitoring the experiment. A description follows.

Web dashboard monitoring

You can monitor your experiment on your MissingLink dashboard.

Click on the experiment to view your metric graphs.

Next steps

Learn more about integrating with PyCaffe to enable the following MissingLink features: