deeplabcut.pose_estimation_tensorflow.lib.trackingutils
Backwards compatibility.
Classes:
| Name | Description |
|---|---|
BaseTracker |
Base class for a constant-velocity Kalman filter-based tracker. |
BoxTracker |
|
EllipseFitter |
|
SORTBox |
|
Functions:
| Name | Description |
|---|---|
reconstruct_all_ellipses |
Reconstructs ellipses for multiple individuals based on their body part |
BaseTracker
Base class for a constant-velocity Kalman filter-based tracker.
Source code in deeplabcut/core/trackingutils.py
BoxTracker
Bases: BaseTracker
Methods:
| Name | Description |
|---|---|
convert_bbox_to_z |
Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form |
convert_x_to_bbox |
Takes a bounding box in the centre form [x,y,s,r] and returns it in the form |
Source code in deeplabcut/core/trackingutils.py
convert_bbox_to_z
staticmethod
Takes a bounding box in the form [x1,y1,x2,y2] and returns z in the form [x,y,s,r] where x,y is the centre of the box and s is the scale/area and r is the aspect ratio.
Source code in deeplabcut/core/trackingutils.py
convert_x_to_bbox
staticmethod
Takes a bounding box in the centre form [x,y,s,r] and returns it in the form [x1,y1,x2,y2] where x1,y1 is the top left and x2,y2 is the bottom right.
Source code in deeplabcut/core/trackingutils.py
EllipseFitter
Methods:
| Name | Description |
|---|---|
calc_parameters |
Calculate ellipse center coordinates, semi-axes lengths, and |
Source code in deeplabcut/core/trackingutils.py
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 | |
calc_parameters
staticmethod
Calculate ellipse center coordinates, semi-axes lengths, and the counterclockwise angle of rotation from the x-axis to the ellipse major axis. Visit http://mathworld.wolfram.com/Ellipse.html for how to estimate ellipse parameters.
:param coeffs: list of fitting coefficients :return: center: 1D ndarray, semi-axes: 1D ndarray, angle: float
Source code in deeplabcut/core/trackingutils.py
SORTBox
Bases: SORTBase
Methods:
| Name | Description |
|---|---|
match_detections_to_trackers |
Assigns detections to tracked object (both represented as bounding boxes) |
Source code in deeplabcut/core/trackingutils.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 | |
match_detections_to_trackers
staticmethod
Assigns detections to tracked object (both represented as bounding boxes)
Returns 3 lists of matches, unmatched_detections and unmatched_trackers
Source code in deeplabcut/core/trackingutils.py
reconstruct_all_ellipses
Reconstructs ellipses for multiple individuals based on their body part
coordinates across multiple frames. Each ellipse is fitted to the coordinates using
an EllipseFitter.
Parameters
data : pandas.DataFrame
A multi-level DataFrame containing body part coordinates and likelihood values.
The index represents frames, and the columns follow a multi-level structure:
- Level 0: Scorer
- Level 1: Individuals
- Level 2: Body parts
- Level 3: Coordinates ("x" and "y") and "likelihood".
sd : float
The standard deviation used by the EllipseFitter for fitting ellipses.
Returns
numpy.ndarray A 3D array of shape (A, F, 5), where: - A is the number of individuals (excluding "single" if present). - F is the number of frames. - Each row contains ellipse parameters [cx, cy, width, height, angle].
Notes
- The method drops the "likelihood" column from the input DataFrame as it is not relevant for ellipse fitting.
- If the "single" individual is present, it is excluded from the reconstruction process.
- The
EllipseFitteris used to fit ellipses to the body part coordinates for each individual in each frame. - NaN values are assigned when no valid ellipse can be fitted.