classTrackState:""" Enumeration class representing the possible states of an object being tracked. Attributes: New (int): State when the object is newly detected. Tracked (int): State when the object is successfully tracked in subsequent frames. Lost (int): State when the object is no longer tracked. Removed (int): State when the object is removed from tracking. """New=0Tracked=1Lost=2Removed=3
ultralytics.trackers.basetrack.BaseTrack
Basisklasse fĂŒr die Objektverfolgung, die grundlegende Attribute und Methoden bereitstellt.
Attribute:
Name
Typ
Beschreibung
_count
int
ZĂ€hler auf Klassenebene fĂŒr eindeutige Track-IDs.
track_id
int
Eindeutiger Bezeichner fĂŒr den Track.
is_activated
bool
Flagge, die anzeigt, ob der Track gerade aktiv ist.
classBaseTrack:""" Base class for object tracking, providing foundational attributes and methods. Attributes: _count (int): Class-level counter for unique track IDs. track_id (int): Unique identifier for the track. is_activated (bool): Flag indicating whether the track is currently active. state (TrackState): Current state of the track. history (OrderedDict): Ordered history of the track's states. features (list): List of features extracted from the object for tracking. curr_feature (any): The current feature of the object being tracked. score (float): The confidence score of the tracking. start_frame (int): The frame number where tracking started. frame_id (int): The most recent frame ID processed by the track. time_since_update (int): Frames passed since the last update. location (tuple): The location of the object in the context of multi-camera tracking. Methods: end_frame: Returns the ID of the last frame where the object was tracked. next_id: Increments and returns the next global track ID. activate: Abstract method to activate the track. predict: Abstract method to predict the next state of the track. update: Abstract method to update the track with new data. mark_lost: Marks the track as lost. mark_removed: Marks the track as removed. reset_id: Resets the global track ID counter. """_count=0def__init__(self):"""Initializes a new track with unique ID and foundational tracking attributes."""self.track_id=0self.is_activated=Falseself.state=TrackState.Newself.history=OrderedDict()self.features=[]self.curr_feature=Noneself.score=0self.start_frame=0self.frame_id=0self.time_since_update=0self.location=(np.inf,np.inf)@propertydefend_frame(self):"""Return the last frame ID of the track."""returnself.frame_id@staticmethoddefnext_id():"""Increment and return the global track ID counter."""BaseTrack._count+=1returnBaseTrack._countdefactivate(self,*args):"""Abstract method to activate the track with provided arguments."""raiseNotImplementedErrordefpredict(self):"""Abstract method to predict the next state of the track."""raiseNotImplementedErrordefupdate(self,*args,**kwargs):"""Abstract method to update the track with new observations."""raiseNotImplementedErrordefmark_lost(self):"""Mark the track as lost."""self.state=TrackState.Lostdefmark_removed(self):"""Mark the track as removed."""self.state=TrackState.Removed@staticmethoddefreset_id():"""Reset the global track ID counter."""BaseTrack._count=0
end_frameproperty
Gibt die letzte Frame-ID des Tracks zurĂŒck.
__init__()
Initialisiert einen neuen Track mit einer eindeutigen ID und grundlegenden Tracking-Attributen.
def__init__(self):"""Initializes a new track with unique ID and foundational tracking attributes."""self.track_id=0self.is_activated=Falseself.state=TrackState.Newself.history=OrderedDict()self.features=[]self.curr_feature=Noneself.score=0self.start_frame=0self.frame_id=0self.time_since_update=0self.location=(np.inf,np.inf)
activate(*args)
Abstrakte Methode zur Aktivierung des Tracks mit angegebenen Argumenten.