deeplabcut.pose_tracking_pytorch.apis
Functions:
| Name | Description |
|---|---|
transformer_reID |
Enables tracking with transformer. |
transformer_reID
transformer_reID(
config: str,
videos: list[str],
video_extensions: str | Sequence[str] | None = None,
shuffle: int = 1,
trainingsetindex: int = 0,
track_method: str = "ellipse",
n_tracks: int | None = None,
n_triplets: int = 1000,
train_epochs: int = 100,
train_frac: float = 0.8,
modelprefix: str = "",
destfolder: str = None,
)
Enables tracking with transformer.
Substeps include
- Mines triplets from tracklets in videos (from another tracker)
- These triplets are later used to tran a transformer with triplet loss
- The transformer derived appearance similarity is then used as a stitching loss when tracklets are stitched during tracking.
Outputs: The tracklet file is saved in the same folder where the non-transformer tracklet file is stored.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
string
|
Full path of the config.yaml file as a string. |
required |
|
list
|
A list of strings containing the full paths to videos for analysis or a path to the directory, where all the videos with same extension are stored. |
required |
|
str | Sequence[str] | None
|
Controls how |
None
|
|
int
|
Which shuffle to use. Defaults to 1. |
1
|
|
int
|
Which training fraction to use, identified by its index. Defaults to 0. |
0
|
|
str
|
Track method from which tracklets are sampled. Defaults to "ellipse". |
'ellipse'
|
|
int | None
|
Number of tracks to be formed in the videos. Defaults to None. |
None
|
|
int
|
Number of triplets to be mined from the videos. Defaults to 1000. |
1000
|
|
int
|
Number of epochs to train the transformer. Defaults to 100. |
100
|
|
float
|
Fraction of triplets used for training/testing of the transformer. Defaults to 0.8. |
0.8
|
|
str
|
Directory containing the deeplabcut models to use. Defaults to "". |
''
|
|
str
|
Destination folder for analysis data. Defaults to None. |
None
|
Examples:
Training a model for one video based on ellipse-tracker derived tracklets:
config = "/home/users/.../dlc-project-2025-01-01/config.yaml"
videos = ["/home/alex/video.mp4"]
deeplabcut.transformer_reID(config, videos, shuffle=1, track_method="ellipse")
deeplabcut.create_labeled_video(
config,
videos,
shuffle=1,
track_method="transformer",
)
Source code in deeplabcut/pose_tracking_pytorch/apis.py
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 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |