API

deephys

class deephys.deephys.DatasetActivity(name, dtype, classes, images)
class deephys.deephys.DeephysData(name)
save(path=None)
Parameters:

path (Optional[str]) – Optional file path to save to. Defaults to <working directory>/name.`<extension for class(test or model)>` Default: None

class deephys.deephys.Image(imageID, categoryID, category, data, features, activations)
class deephys.deephys.Layer(layerID, neurons)
class deephys.deephys.Model(name, layers, classification_layer)
Parameters:
  • name (str) – name of the model (e.g.: β€œresnet18”)

  • layers (List[Layer]) – A List of layers in the model.

  • classification_layer (str) – The name of the classification layer. Must be one of the layers defined in layers.

class ModelState(activations)
class deephys.deephys.Neuron
deephys.deephys.dataset_activity(name, category_names, neural_activity, model, images, groundtruth, dtype='float32')

Prepare test results for Deephys. The order of the images should be consistent with the order of the groundtruth_categories per image and the neural_activity.

Parameters:
  • name (str) – The name of the DatasetActivity

  • category_names (list) – an ordered list of strings representing class names

  • neural_activity (Dict[str, Union[list, ndarray]]) – A dictionary with the name of the layers and their neural activity. The neural activity is an ordered array or list of floats [#images,#neurons]. Length of activations must be the same as the number of images and in the same order.

  • model (Model) – The model structure

  • images (Union[list, ndarray]) – An ordered list of image pixel data [#images,#channels,dim1,dim2] or [#images,dim1,dim2] for greyscale. Pixels must be floats within the range 0.0:1.0

  • groundtruth (Union[List[int], ndarray]) – An ordered list of the ground truth category of each image. The length should be the same as the number of images. Each element should be an integer indicating the index of the category.

  • dtype (str) – The data type to save activation data as: β€œfloat32” or β€œfloat64”. β€œfloat64” is more precise but results in data files almost twice as large. β€œfloat64” may also be slower in the app. The input type does not matter, it will get converted to the type in this argument. Default: β€œfloat32”) Default: "float32"

Returns:

a formatted data object which may be saved to a file

Return type:

deephys.deephys.DatasetActivity

deephys.deephys.model(name, layers, classification_layer)
Parameters:
  • name (str) – The name of the model

  • layers (Dict[str, int]) – A dictionary with the names and number of neurons of each layer.

  • classification_layer (str) – The name of the classification layer. Must be the name of one of the layers defined in layers.