discopat.nn_models package
Submodules
discopat.nn_models.detr module
- class discopat.nn_models.detr.DETRModel(net, label_map, model_parameters)[source]
Bases:
NNModel- Parameters:
net (NeuralNet)
label_map (dict[str, int])
model_parameters (dict)
- class discopat.nn_models.detr.PostProcess(*args, **kwargs)[source]
Bases:
ModuleConvert the model’s output into the format expected by the coco api.
- forward(outputs, target_sizes)[source]
Perform the computation.
- Parameters:
outputs (raw outputs of the model)
target_sizes (tensor of dimension [batch_size x 2] containing the size of each images of the batch) – For evaluation, this must be the original image size (before any data augmentation) For visualization, this should be the image size after data augment, but before padding
discopat.nn_models.faster_rcnn module
- class discopat.nn_models.faster_rcnn.FasterRCNNModel(net, label_map, model_parameters)[source]
Bases:
NNModel- Parameters:
net (NeuralNet)
label_map (dict[str, int])
model_parameters (dict)
- make_box_from_tensors(box_xyxy, label, score)[source]
- Parameters:
box_xyxy (Tensor)
label (Tensor)
score (Tensor)
- Return type:
- post_process(raw_predictions)[source]
Adapt the internal detector’s predictions to discopat’s format.
- Parameters:
raw_predictions (list[dict[Tensor]])
- Return type:
list[Box]
- 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:
Tensor
- property reversed_label_map
- set_device(device)[source]
- Parameters:
device (ComputingDevice)
- Return type:
None
discopat.nn_models.torch_box_ops module
Utilities for bounding box manipulation and GIoU.
- discopat.nn_models.torch_box_ops.generalized_box_iou(boxes1, boxes2)[source]
Generalized IoU from https://giou.stanford.edu/.
The boxes should be in [x0, y0, x1, y1] format
Returns a [N, M] pairwise matrix, where N = len(boxes1) and M = len(boxes2)
Module contents
- class discopat.nn_models.FasterRCNNModel(net, label_map, model_parameters)[source]
Bases:
NNModel- Parameters:
net (NeuralNet)
label_map (dict[str, int])
model_parameters (dict)
- make_box_from_tensors(box_xyxy, label, score)[source]
- Parameters:
box_xyxy (Tensor)
label (Tensor)
score (Tensor)
- Return type:
- post_process(raw_predictions)[source]
Adapt the internal detector’s predictions to discopat’s format.
- Parameters:
raw_predictions (list[dict[Tensor]])
- Return type:
list[Box]
- 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:
Tensor
- property reversed_label_map
- set_device(device)[source]
- Parameters:
device (ComputingDevice)
- Return type:
None