Skip to content

Commit 1e7b806

Browse files
authored
guide for pose estimation - flipping (#884)
1 parent 9d125ca commit 1e7b806

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

docs/modules/prepro.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
API - Data Pre-processing
1+
API - Data Pre-Processing
22
=========================
33

44
.. automodule:: tensorlayer.prepro
@@ -221,7 +221,7 @@ The sequential transformation can be represented as ``y = Tk (... T1(x))``,
221221
and the time complexity is ``O(k N)`` where ``N`` is the cost of applying one transformation to image ``x``.
222222
``N`` is linear to the size of ``x``.
223223
For the combined transformation ``y = (Tk ... T1) (x)``
224-
the time complexity is ``O(27(k - 1) + N) = max{O(27k), O(N)} = O(N)`` (assuming 27k << N) where 27 = 3^3 is the cost for combine two transformations.
224+
the time complexity is ``O(27(k - 1) + N) = max{O(27k), O(N)} = O(N)`` (assuming 27k << N) where 27 = 3^3 is the cost for combining two transformations.
225225

226226

227227
Get rotation matrix

tensorlayer/prepro.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@ def affine_transform_keypoints(coords_list, transform_matrix):
581581
"""Transform keypoint coordinates according to a given affine transform matrix.
582582
OpenCV format, x is width.
583583
584+
Note that, for pose estimation task, flipping requires maintaining the left and right body information.
585+
We should not flip the left and right body, so please use ``tl.prepro.keypoint_random_flip``.
586+
584587
Parameters
585588
-----------
586589
coords_list : list of list of tuple/list
@@ -3995,7 +3998,10 @@ def keypoint_random_flip(
39953998
prob : float, 0 to 1
39963999
The probability to flip the image, if 1, always flip the image.
39974000
flip_list : tuple of int
3998-
Denotes how the keypoints number be changed after flipping. Default COCO format.
4001+
Denotes how the keypoints number be changed after flipping which is required for pose estimation task.
4002+
The left and right body should be maintained rather than switch.
4003+
(Default COCO format).
4004+
Set to an empty tuple if you don't need to maintain left and right information.
39994005
40004006
Returns
40014007
----------

0 commit comments

Comments
 (0)