type

costs.GalleryCost

class GalleryCost:

Cosine cost between detections and each tracklet's embedding gallery.

For tracklet gallery ``(N, K, D)`` and detections ``(M, D)``, computes the cosine similarity ``(N, K, M)``, masks gallery slots that are not yet filled (per the count field), reduces over the ``K`` slots, and returns ``1 - similarity`` as an ``(N, M)`` cost.

Parameters

NameTypeDescription
gallery_fieldstrTracklet field holding the ``(N, K, D)`` gallery buffer.
count_fieldstrTracklet field holding the ``(N,)`` fill count (number of appends).
fieldstrDetection field holding the ``(M, D)`` query embedding.
reduce = "max"('max', 'mean')Slot reduction. ``"max"`` takes the best-matching historical view (robust to appearance change); ``"mean"`` averages valid slots.
eps = 1e-12floatLower bound on the L2 norm used for normalisation.

Raises

  • ValueError — If ``reduce`` is not ``"max"`` or ``"mean"``.

Members

method

Source: unitrack/costs/gallery.py:30