discopat.core.entities.detection

Classes

CDModel()

Abstract class representing convolutional-dictionary-based models.

Model()

Abstract class to represent a pattern detection model.

NNModel(net, label_map, model_parameters)

Abstract class representing neural-network-based models.

NeuralNet()

Abstract class to model a neural network.

class discopat.core.entities.detection.CDModel[source]

Bases: Model

Abstract class representing convolutional-dictionary-based models.

class discopat.core.entities.detection.Model[source]

Bases: ABC

Abstract class to represent a pattern detection model.

abstractmethod classmethod from_dict(model_as_dict)[source]
Parameters:

model_as_dict (dict)

Return type:

Self

abstractmethod post_process(raw_predictions)[source]

Adapt the internal detector’s predictions to discopat’s format.

Parameters:

raw_predictions (Any)

Return type:

list[Annotation]

abstractmethod pre_process(frame)[source]

Prepare the frame’s array to pass through the internal detector.

Can be a neural net, a convolutional sparse encoder…

Parameters:

frame (Frame)

Return type:

Array

abstractmethod predict(frame)[source]

Run the predictions of the model on a frame.

Parameters:

frame (Frame) – Object representing the image or movie frame on which the model will be applied.

Returns:

The input frame where the model predictions have been

appended to the list of already present annotations.

Return type:

Frame

abstractmethod to_dict()[source]
Return type:

dict

class discopat.core.entities.detection.NNModel(net, label_map, model_parameters)[source]

Bases: Model

Abstract class representing neural-network-based models.

Parameters:
  • net (NeuralNet)

  • label_map (dict[str, int])

  • model_parameters (dict)

predict(frame)[source]

Run the predictions of the model on a frame.

The method follows the following scheme:
  • input_frame ——[pre-processing ]–> input_array,

  • input_array ——[ net ]–> raw_predictions,

  • raw_predictions –[post_processing]–> output_frame.

Parameters:

frame (Frame) – Object representing the image or movie frame on which the model will be applied.

Returns:

The input frame where the model predictions have been

appended to the list of already present annotations.

Return type:

Frame

abstractmethod set_device(device)[source]
Parameters:

device (ComputingDevice)

Return type:

None

class discopat.core.entities.detection.NeuralNet[source]

Bases: object

Abstract class to model a neural network.