deeplabcut.pose_estimation_pytorch.apis.tracking_dataset
Code to create tracking datasets for ReID model training.
Functions:
| Name | Description |
|---|---|
build_feature_extraction_runner |
Builds a runner to extract backbone features for poses of individuals. |
create_tracking_dataset |
Creates a tracking dataset to train a ReID tracklet stitcher. |
extract_features_for_video |
Extracts backbone features for predicted keypoints in a video. |
build_feature_extraction_runner
build_feature_extraction_runner(
loader: Loader, snapshot_path: str | Path, device: str, batch_size: int = 1
) -> runners.PoseInferenceRunner
Builds a runner to extract backbone features for poses of individuals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
Loader
|
The loader for the model to use. |
required |
|
str | Path
|
The path of the snapshot to use. |
required |
|
str
|
The device on which to run pose estimation. |
required |
|
int
|
The batch size to run pose estimation with. |
1
|
Returns:
| Type | Description |
|---|---|
PoseInferenceRunner
|
A PoseInferenceRunner that will return features for extracted pose. |
Source code in deeplabcut/pose_estimation_pytorch/apis/tracking_dataset.py
create_tracking_dataset
create_tracking_dataset(
config: str,
videos: list[str] | list[Path],
track_method: str,
video_extensions: str | Sequence[str] | None = None,
shuffle: int = 1,
trainingsetindex: int = 0,
destfolder: str | None = None,
batch_size: int | None = None,
detector_batch_size: int | None = None,
cropping: list[int] | None = None,
modelprefix: str = "",
robust_nframes: bool = False,
n_triplets: int = 1000,
) -> str
Creates a tracking dataset to train a ReID tracklet stitcher.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
Full path of the config.yaml file for the project |
required |
|
list[str] | list[Path]
|
A str (or list of strings) containing the full paths to videos from which to create the tracking dataset or a path to the directory, where all the videos with same extension are stored. |
required |
|
str
|
Specifies the tracker used to generate the pose estimation data. Must be either 'box', 'skeleton', or 'ellipse'. |
required |
|
str | Sequence[str] | None
|
Controls how |
None
|
|
int
|
An integer specifying the shuffle index of the training dataset used for training the network. |
1
|
|
int
|
Integer specifying which TrainingsetFraction to use. |
0
|
|
str | None
|
Specifies the destination folder for the tracking data. If |
None
|
|
int | None
|
The batch size to use for inference. Takes the value from the project config as a default. |
None
|
|
int | None
|
The batch size to use for detector inference. Takes the value from the project config as a default. |
None
|
|
list[int] | None
|
List of cropping coordinates as [x1, x2, y1, y2]. Note that the same
cropping parameters will then be used for all videos. If different video
crops are desired, run |
None
|
|
str
|
Directory containing the deeplabcut models to use when evaluating the network. By default, they are assumed to exist in the project folder. |
''
|
|
bool
|
Evaluate a video's number of frames in a robust manner. This option is slower (as the whole video is read frame-by-frame), but does not rely on metadata, hence its robustness against file corruption. |
False
|
|
int
|
The number of triplets to extract for the dataset. |
1000
|
Returns:
| Type | Description |
|---|---|
str
|
The scorer used to analyze the videos. |
Source code in deeplabcut/pose_estimation_pytorch/apis/tracking_dataset.py
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 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 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 | |
extract_features_for_video
extract_features_for_video(
runner: PoseInferenceRunner,
video: VideoIterator,
shelf_writer: FeatureShelfWriter,
detector_runner: DetectorInferenceRunner | None = None,
) -> None
Extracts backbone features for predicted keypoints in a video.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
VideoIterator
|
The video for which to extract backbone features. |
required |
|
PoseInferenceRunner
|
The inference runner with which to extract backbone features. |
required |
|
FeatureShelfWriter
|
The ShelfWriter used to extract features. |
required |
|
DetectorInferenceRunner | None
|
For top-down models, the detector to use to predict bboxes. |
None
|