discopat.core package
Subpackages
- discopat.core.entities package
- Submodules
- discopat.core.entities.annotation module
- discopat.core.entities.array module
- discopat.core.entities.data module
- discopat.core.entities.detection module
- discopat.core.entities.frame module
- discopat.core.entities.metadata module
- discopat.core.entities.movie module
- discopat.core.entities.tracking module
- Module contents
Submodules
discopat.core.value_objects module
- class discopat.core.value_objects.ComputingDevice(*values)[source]
Bases:
Enum- cpu = 'cpu'
- gpu = 'gpu'
Module contents
- class discopat.core.Annotation(label, score)[source]
Bases:
MetadataAbstract class to represent annotations and model predictions.
- Parameters:
label (str)
score (float)
- classmethod printable_fields()[source]
List of the relevant fields to serialise the object.
- Return type:
list[str]
- abstractmethod rescale(w_ratio, h_ratio)[source]
Rescale object.
- Parameters:
w_ratio (float) – Width ratio.
h_ratio (float) – Height ratio.
- Return type:
None
- property type: str
Handle for annotation types (box, keypoint, track, …).
- class discopat.core.Box(label, x, y, width, height, score)[source]
Bases:
AnnotationClass to represent bounding boxes.
- Parameters:
label (str)
x (float)
y (float)
width (float)
height (float)
score (float)
- classmethod from_dict(data_as_dict)[source]
Make object from a dictionary.
- Parameters:
data_as_dict (dict)
- Return type:
Self
- classmethod printable_fields()[source]
List of the relevant fields to serialise the object.
- Return type:
list[str]
- rescale(w_ratio, h_ratio)[source]
Rescale object.
- Parameters:
w_ratio (float) – Width ratio.
h_ratio (float) – Height ratio.
- Return type:
None
- property xmax: float
Xmax for XYXY format.
- property xmin: float
Xmin for XYXY format.
- property ymax: float
Ymax for XYXY format.
- property ymin: float
Ymin for XYXY format.
- class discopat.core.CDModel[source]
Bases:
ModelAbstract class representing convolutional-dictionary-based models.
- class discopat.core.DataLoader(*args, **kwargs)[source]
Bases:
Protocol[X_co,Y_co]Generic interface for objects yielding (X, y) pairs.
- property batch_size: int | None
Return the number of samples per batch, if known.
- class discopat.core.Dataset(*args, **kwargs)[source]
Bases:
Protocol[X_co,Y_co]A dataset providing indexed access to samples.
- class discopat.core.Frame(name, width, height, annotations, image_array=None)[source]
Bases:
MetadataClass to model movie frames or images.
- Parameters:
name (str)
width (int)
height (int)
annotations (list[Annotation])
image_array (Array)
- classmethod from_dict(data_as_dict)[source]
Make object from a dictionary.
- Parameters:
data_as_dict (dict)
- Return type:
Self
- classmethod printable_fields()[source]
List of the relevant fields to serialise the object.
- Return type:
list[str]
- class discopat.core.Keypoint(label, point_list, score)[source]
Bases:
AnnotationClass to represent keypoint annotations (e.g., for pose estimation).
- Parameters:
label (str)
point_list (list[tuple[float, float]])
score (float)
- classmethod from_dict(data_as_dict)[source]
Make object from a dictionary.
- Parameters:
data_as_dict (dict)
- Return type:
Self
- class discopat.core.Model[source]
Bases:
ABCAbstract 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…
- class discopat.core.Movie(name, frames, tracks)[source]
Bases:
Metadata- classmethod from_dict(data_as_dict)[source]
Make object from a dictionary.
- Parameters:
data_as_dict (dict)
- Return type:
Self
- classmethod printable_fields()[source]
List of the relevant fields to serialise the object.
- Return type:
list[str]
- class discopat.core.NNModel(net, label_map, model_parameters)[source]
Bases:
ModelAbstract 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.
- abstractmethod set_device(device)[source]
- Parameters:
device (ComputingDevice)
- Return type:
None
- class discopat.core.Track(track_id, box_list)[source]
Bases:
AnnotationClass to represent object tracks accross frames in a movie.
- Parameters:
track_id (int)
box_list (list[tuple[int, Box]])