mri.dispatch package

mri.dispatch.BaseDispatch module

class mri.dispatch.BaseDispatch.BaseDispatch

Bases: object

Base class to dispatch new actions to whatever backend you want

setup_display(time_axis, attributes)

Create whatever front end we’re using

train_event(event)

Parse a line of output from a training caffe object

train_finish()

Call once training is finished

mri.dispatch.MatplotlibDispatch module

Warning

The Matplotlib dispatch currently only fully supports the Qt4Agg backend, as this is the only backend that we found to reliably work with automatic updating of the plot.

class mri.dispatch.MatplotlibDispatch.MatplotlibDispatch(task_params, img_folder)

Bases: mri.dispatch.BaseDispatch.BaseDispatch

Display events via Matplotlib backend. This class requires some heavy dependencies, and so trying to run it without Matplotlib and Numpy installed will result in pass-thru behavior

Parameters:
  • task_params (dict) – Dictionary of the task json specification, including name and ID number
  • img_folder (string) – Folder to save output images to
setup_display(time_axis, attributes, show_windows=False)
train_event(event)

Plot a basic training and testing curve via Matplotlib

Parameters:event (TrainingEvent.TrainingEvent) – Event to add to Matplotlib plot
train_finish()

Save our output figure to PNG format, as defined by the save path img_folder

mri.dispatch.MriServerDispatch module

class mri.dispatch.MriServerDispatch.MriServerDispatch(task_params, address, username, password)

Bases: mri.dispatch.BaseDispatch.BaseDispatch

Display events via the mri-Server front-end. For this dispatch, we will treat each task as a separate report. There may be multiple visualizations on the server for a report, and there may be multiple directives in a task. These two, however, aren’t necessarily one-to-one. Each dispatch is isolated from the server itself to emphasize the stateless nature of the monitoring tool and avoid deadlikes and the like. That means that to perform actions like clearing the server or clearing a specific visualization you’ll need to create an MriServer class instead.

Parameters:
  • task_params (dict) – Dictionary of the task json specification, including title and ID number
  • address (string) – Server address, generally a hosted URL
  • username (string) – Username for the mri-server
  • password (string) – Password for the mri-server
setup_display(time_axis, attributes)

Create a report for this dispatch, usually done at init

Parameters:
  • time_axis (string) – Name of attribute representing time eg. iterations, epoch, etc
  • attributes (list) – List of strings representing attributes to plot eg. loss, accuracy, learning rate, etc. If time_axis attribute is present it will be ignored.
Returns:

result – Result of the report creation request

Return type:

requests.Response

train_event(event)

Dispatch training events to the mri-server via REST interface

Parameters:
  • event (TrainingEvent.TrainingEvent) – Info for this training event
  • event_url (string) – URI to send post events to in mri-server (shouldn’t need to change)
Returns:

result – Result of the training event request

Return type:

requests.Response

train_finish()

Final call for training, can be used to issue alerts/etc. Currently unused.