xuepengqiang
2020-05-26 bb5cb224c9abe4216aaa49a8287b06d9f05dab60
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
3
¦å»]3ã@s Gdd„dƒZGdd„dƒZdS)c@seZdZdZdZdZdZdS)Ú
TrackStateaP
    Enumeration type for the single target track state. Newly created tracks are
    classified as `tentative` until enough evidence has been collected. Then,
    the track state is changed to `confirmed`. Tracks that are no longer alive
    are classified as `deleted` to mark them for removal from the set of active
    tracks.
 
    éééN)Ú__name__Ú
__module__Ú __qualname__Ú__doc__Ú    TentativeÚ    ConfirmedÚDeleted©r r úFD:\project\07_tracking_Re-id\04_s_yolo_tracking\lib\deep_sort\track.pyrsrc@sZeZdZdZddd„Zdd„Zdd„Zd    d
„Zd d „Zd d„Z    dd„Z
dd„Z dd„Z dS)ÚTracka2
    A single target track with state space `(x, y, a, h)` and associated
    velocities, where `(x, y)` is the center of the bounding box, `a` is the
    aspect ratio and `h` is the height.
 
    Parameters
    ----------
    mean : ndarray
        Mean vector of the initial state distribution.
    covariance : ndarray
        Covariance matrix of the initial state distribution.
    track_id : int
        A unique track identifier.
    n_init : int
        Number of consecutive detections before the track is confirmed. The
        track state is set to `Deleted` if a miss occurs within the first
        `n_init` frames.
    max_age : int
        The maximum number of consecutive misses before the track state is
        set to `Deleted`.
    feature : Optional[ndarray]
        Feature vector of the detection this track originates from. If not None,
        this feature is added to the `features` cache.
 
    Attributes
    ----------
    mean : ndarray
        Mean vector of the initial state distribution.
    covariance : ndarray
        Covariance matrix of the initial state distribution.
    track_id : int
        A unique track identifier.
    hits : int
        Total number of measurement updates.
    age : int
        Total number of frames since first occurance.
    time_since_update : int
        Total number of frames since last measurement update.
    state : TrackState
        The current track state.
    features : List[ndarray]
        A cache of features. On each measurement update, the associated feature
        vector is added to this list.
 
    NcCsV||_||_||_d|_d|_d|_tj|_g|_    |dk    rF|j    j
|ƒ||_ ||_ dS)Nré) ÚmeanÚ
covarianceÚtrack_idÚhitsÚageÚtime_since_updaterr    ÚstateÚfeaturesÚappendÚ_n_initÚ_max_age)ÚselfrrrÚn_initÚmax_ageÚfeaturer r r Ú__init__Bs zTrack.__init__cCsJ|jdd…jƒ}|d|d9<|dd…|dd…d8<|S)z·Get current position in bounding box format `(top left x, top left y,
        width, height)`.
 
        Returns
        -------
        ndarray
            The bounding box.
 
        Nérr)rÚcopy)rÚretr r r Úto_tlwhSs
 z Track.to_tlwhcCs,|jƒ}|dd…|dd…|dd…<|S)z«Get current position in bounding box format `(min x, miny, max x,
        max y)`.
 
        Returns
        -------
        ndarray
            The bounding box.
 
        Nr)r#)rr"r r r Úto_tlbrbs
 z Track.to_tlbrcCs8|j|j|jƒ\|_|_|jd7_|jd7_dS)zàPropagate the state distribution to the current time step using a
        Kalman filter prediction step.
 
        Parameters
        ----------
        kf : kalman_filter.KalmanFilter
            The Kalman filter.
 
        rN)Úpredictrrrr)rÚkfr r r r%ps
z Track.predictcCsd|j|j|j|jƒƒ\|_|_|jj|jƒ|jd7_d|_|j    t
j kr`|j|j kr`t
j |_    dS)aPerform Kalman filter measurement update step and update the feature
        cache.
 
        Parameters
        ----------
        kf : kalman_filter.KalmanFilter
            The Kalman filter.
        detection : Detection
            The associated detection.
 
        rrN)ÚupdaterrÚto_xyahrrrrrrrr    rr
)rr&Ú    detectionr r r r'~s z Track.updatecCs.|jtjkrtj|_n|j|jkr*tj|_dS)zMMark this track as missed (no association at the current time step).
        N)rrr    r rr)rr r r Ú mark_missed”s 
 zTrack.mark_missedcCs |jtjkS)z?Returns True if this track is tentative (unconfirmed).
        )rrr    )rr r r Ú is_tentativeœszTrack.is_tentativecCs |jtjkS)z(Returns True if this track is confirmed.)rrr
)rr r r Ú is_confirmed¡szTrack.is_confirmedcCs |jtjkS)z9Returns True if this track is dead and should be deleted.)rrr )rr r r Ú
is_deleted¥szTrack.is_deleted)N) rrrrrr#r$r%r'r*r+r,r-r r r r rs-
rN)rrr r r r Ú<module>s