From 1e7b806e1b15d55b2722ab3e9f8a4a8b75c15309 Mon Sep 17 00:00:00 2001 From: Hao Date: Fri, 2 Nov 2018 19:11:09 +0800 Subject: [PATCH] guide for pose estimation - flipping (#884) --- docs/modules/prepro.rst | 4 ++-- tensorlayer/prepro.py | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/modules/prepro.rst b/docs/modules/prepro.rst index 6423236dd..2e4b739ab 100644 --- a/docs/modules/prepro.rst +++ b/docs/modules/prepro.rst @@ -1,4 +1,4 @@ -API - Data Pre-processing +API - Data Pre-Processing ========================= .. automodule:: tensorlayer.prepro @@ -221,7 +221,7 @@ The sequential transformation can be represented as ``y = Tk (... T1(x))``, and the time complexity is ``O(k N)`` where ``N`` is the cost of applying one transformation to image ``x``. ``N`` is linear to the size of ``x``. For the combined transformation ``y = (Tk ... T1) (x)`` -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. +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. Get rotation matrix diff --git a/tensorlayer/prepro.py b/tensorlayer/prepro.py index 60b6434fa..d409f1cdb 100644 --- a/tensorlayer/prepro.py +++ b/tensorlayer/prepro.py @@ -581,6 +581,9 @@ def affine_transform_keypoints(coords_list, transform_matrix): """Transform keypoint coordinates according to a given affine transform matrix. OpenCV format, x is width. + Note that, for pose estimation task, flipping requires maintaining the left and right body information. + We should not flip the left and right body, so please use ``tl.prepro.keypoint_random_flip``. + Parameters ----------- coords_list : list of list of tuple/list @@ -3995,7 +3998,10 @@ def keypoint_random_flip( prob : float, 0 to 1 The probability to flip the image, if 1, always flip the image. flip_list : tuple of int - Denotes how the keypoints number be changed after flipping. Default COCO format. + Denotes how the keypoints number be changed after flipping which is required for pose estimation task. + The left and right body should be maintained rather than switch. + (Default COCO format). + Set to an empty tuple if you don't need to maintain left and right information. Returns ----------