SDK ML Algorithms

template<typename DetectionBox>
class DataAssociation

Module that matches detections with computed tracklets.

Template Parameters

DetectionBox – The type of detection bounding box to process

Public Types

using TrackletCallback = std::function<void(const EventTrackedBox*, const EventTrackedBox*, timestamp ts)>

Function to call when new tracklets are produced.

Public Functions

DataAssociation(const Config &conf)

Constructor.

Parameters

conf – The configuration parameters

~DataAssociation() = default

Destructor.

template<typename InputIt>
inline void process_events(InputIt begin, InputIt end)

Updates the internal time surface with provided events.

Template Parameters

Iterator – over events to process, typically EventCD

Parameters
  • begin – Iterator to the first event

  • end – Iterator to the past-the-end evet

template<typename InputBoxIt>
inline void process_boxes(InputBoxIt start_box, InputBoxIt end_box, timestamp ts)

Processes the input boxes and provided tracked ones (after association)

Template Parameters

Iterator – over DetectionBox-like objects to process

Parameters
  • start_box – Iterator to the first box to process

  • end_box – Iterator to the past-the-end box to process

  • ts – Timestamp of boxes

void add_tracklet_consumer_cb(TrackletCallback cb)

Sets a callback that is called when tracklets are computed.

Parameters

cb – The callback to be called

struct Config

Public Members

bool use_descriptor

Boolean to enable the use of a descriptor.

int height

Dimensions of the input event flow.

size_t nb_classes

Number of classes possible for input detections.

timestamp time_surface_memory

Time slice for the timesurface generation (events older than this duration will not be considered to produce the image)

std::vector<float> similarity_matrix

(nb_classes*nb_classes) matrix values describing objects similarity

float max_iou_inter_track

Allowed IOU between two tracks.

float iou_to_match_a_detection

Minimum IOU to accept a match with a detection.

float max_iou_for_one_det_to_many_tracks

IOU threshold above which a detection with one track is not updated (the detection is ignored)

float detection_update_weight

Weight to merge a tracklet and a detection. Takes a float value in range [0; 1] (0 means use only tracklet box, 1 means use only detection box)

bool do_tracklet_prediction_

Determine if tracklets should be updated between detections with their speed estimate

float tracking_confidence_decay

Decay in the confidence of the tracklet when not updated.

int detection_threshold

In order to be properly created and returned, a new track must be supported by a certain number of consecutive detections

timestamp deletion_time

Time before deleting a tracklet no longer supported by new detections.

class NonMaximumSuppression

Class to filter and rescale bounding boxes following the non-maximum suppression algorithm to remove overlapping boxes.

Public Functions

NonMaximumSuppression(std::size_t num_classes, float iou_threshold, float scale_width = 1.f, float scale_height = 1.f)

Constructor.

Parameters
  • num_classes – Number of possible class for input boxes

  • iou_threshold – Threshold on IOU metrics to consider that two boxes are matching

  • scale_width – Factor to apply to horizontal coordinates of the output boxes

  • scale_height – Factor to apply to vertical coordinates of the output boxes

template<typename InputIt, typename OutputIt>
void process_events(const InputIt it_begin, const InputIt it_end, OutputIt inserter)

Filters and rescales provided boxes.

Template Parameters
  • InputIt – Read-Only input iterator type over EventBbox-es

  • OutputIt – Read-Write output iterator type over EventBbox-es

Parameters
  • it_begin – Iterator to the first box

  • it_end – Iterator to the past-the-end box

  • inserter – Output iterator or back inserter

void ignore_class_id(std::size_t class_id)

Configures the computation to ignore input boxes from a given class.

Parameters

class_id – Identifier of the class to be ignored