deeplabcut.pose_estimation_pytorch.data.transforms
Classes:
| Name | Description |
|---|---|
CoarseDropout |
|
Grayscale |
|
HFlip |
Horizontal Flip which swaps symmetric keypoints. |
KeepAspectRatioResize |
Resizes images while preserving their aspect ratio. |
KeypointAwareCrop |
Random crop for an image around keypoints. |
RandomBBoxTransform |
Random jittering for bounding boxes for top-down pose estimation models. |
Functions:
| Name | Description |
|---|---|
build_auto_padding |
Create an albumentations PadIfNeeded transform from a config. |
CoarseDropout
Bases: CoarseDropout
Source code in deeplabcut/pose_estimation_pytorch/data/transforms.py
Grayscale
Bases: ToGray
Methods:
| Name | Description |
|---|---|
__init__ |
Args: |
Source code in deeplabcut/pose_estimation_pytorch/data/transforms.py
__init__
__init__(alpha: float | int | tuple[float, float] = 1.0, always_apply: bool = False, p: float = 0.5)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
float | int | tuple[float, float]
|
int, float or tuple of floats, optional |
1.0
|
Source code in deeplabcut/pose_estimation_pytorch/data/transforms.py
HFlip
Bases: HorizontalFlip
Horizontal Flip which swaps symmetric keypoints.
Source code in deeplabcut/pose_estimation_pytorch/data/transforms.py
KeepAspectRatioResize
Bases: DualTransform
Resizes images while preserving their aspect ratio.
In 'pad' mode, the image will be rescaled to the largest possible size such that it can be padded to the correct size (with PadIfNeeded). So we'll have: output_width <= width, output_height <= height
In 'crop' mode, the image will be rescaled to the smallest possible size such that it can be cropped to the correct size (with any random crop you want), so: output_width >= width, output_height >= height
Source code in deeplabcut/pose_estimation_pytorch/data/transforms.py
KeypointAwareCrop
Bases: RandomCrop
Random crop for an image around keypoints.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int
|
Crop images down to this maximum width. |
required |
|
int
|
Crop images down to this maximum height. |
required |
|
float
|
Maximum allowed shift of the cropping center position as a fraction of the crop size. |
0.4
|
|
str
|
Crop centers sampling method. Must be either: "uniform" (randomly over the image), "keypoints" (randomly over the annotated keypoints), "density" (weighing preferentially dense regions of keypoints), "hybrid" (alternating randomly between "uniform" and "density"). |
'hybrid'
|
Source code in deeplabcut/pose_estimation_pytorch/data/transforms.py
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 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 | |
RandomBBoxTransform
Bases: DualTransform
Random jittering for bounding boxes for top-down pose estimation models.
Implementation based on the mmpose RandomBBoxTransform. For more information,
see https://github.com/open-mmlab/mmpose.
Source code in deeplabcut/pose_estimation_pytorch/data/transforms.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 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 | |
build_auto_padding
build_auto_padding(
min_height: int | None = None,
min_width: int | None = None,
pad_height_divisor: int | None = 1,
pad_width_divisor: int | None = 1,
position: str = "random",
border_mode: str = "reflect_101",
border_value: float | None = None,
border_mask_value: float | None = None,
) -> A.PadIfNeeded
Create an albumentations PadIfNeeded transform from a config.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
int | None
|
the minimum height of the image |
None
|
|
int | None
|
the minimum width of the image |
None
|
|
int | None
|
if not None, ensures height is dividable by value of this argument |
1
|
|
int | None
|
if not None, ensures width is dividable by value of this argument |
1
|
|
str
|
position of the image, one of the possible PadIfNeeded |
'random'
|
|
str
|
'constant' or 'reflect_101' (see cv2.BORDER modes) |
'reflect_101'
|
|
float | None
|
padding value if border_mode is 'constant' |
None
|
|
float | None
|
padding value for mask if border_mode is 'constant' |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
Only one of 'min_height' and 'pad_height_divisor' parameters must be set Only one of 'min_width' and 'pad_width_divisor' parameters must be set |
Returns:
| Type | Description |
|---|---|
PadIfNeeded
|
the auto-padding transform |