def affine_transform_keypoints(coords_list, transform_matrix):
coords_result_list = []<EOL>for coords in coords_list:<EOL><INDENT>coords = np.asarray(coords)<EOL>coords = coords.transpose([<NUM_LIT:1>, <NUM_LIT:0>])<EOL>coords = np.insert(coords, <NUM_LIT:2>, <NUM_LIT:1>, axis=<NUM_LIT:0>)<EOL>coords_result = np.matmul(transform_matrix, coords)<EOL>coords_result = coords_result[<NUM_LIT:0>:<NUM_LIT:2>, :].transpose([<NUM_LIT:1>, <NUM_LIT:0>])<EOL>coords_result_list.append(coords_result)<EOL><DEDENT>return coords_result_list<EOL>
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
        The coordinates
        e.g., the keypoint coordinates of every person in an image.
    transform_matrix : numpy.array
        Transform matrix, OpenCV format.

    Examples
    ---------
    >>> # 1. get all affine transform matrices
    >>> M_rotate = tl.prepro.affine_rotation_matrix(angle=20)
    >>> M_flip = tl.prepro.affine_horizontal_flip_matrix(prob=1)
    >>> # 2. combine all affine transform matrices to one matrix
    >>> M_combined = dot(M_flip).dot(M_rotate)
    >>> # 3. transfrom the matrix from Cartesian coordinate (the origin in the middle of image)
    >>> # to Image coordinate (the origin on the top-left of image)
    >>> transform_matrix = tl.prepro.transform_matrix_offset_center(M_combined, x=w, y=h)
    >>> # 4. then we can transfrom the image once for all transformations
    >>> result = tl.prepro.affine_transform_cv2(image, transform_matrix)  # 76 times faster
    >>> # 5. transform keypoint coordinates
    >>> coords = [[(50, 100), (100, 100), (100, 50), (200, 200)], [(250, 50), (200, 50), (200, 100)]]
    >>> coords_result = tl.prepro.affine_transform_keypoints(coords, transform_matrix)