Sort Poses by XYZ Values

Functions

This Step sorts poses from the input pose list by any of the X, Y, or Z values and outputs the sorted list and its index list. Other data lists related to poses, such as masks, can be reordered based on the index list of the sorted poses.

  • Input: a list of poses to be sorted.

  • Output: the sorted list of poses and the index list of the sorted list.

Sample Scenario

This Step can be used when a pose list needs to be sorted based on the poses’ X, Y, or Z values, and when other lists of data related to poses, such as masks and labels, need to be reordered based on the sorting result.

When the mask list output from an Instance Segmentation step needs to be reordered based on the sorting result, the programming as shown in Figure 1 can be used.

../../../../../_images/mask_descending.png

Figure 1. Recommended programming for reordering based on sorting

  1. Pose list to be sorted.

  2. Mask list to be sorted.

  3. Sorted pose list.

  4. Index list of sorted pose list.

  5. Reordered mask list based on the sorting result.

Parameters

Sort Order
Description: Decide whether to sort in ascending or descending order.
Values:
- Ascending
- Descending
../../../../../_images/descend.png
Value for Sorting
Description: Decide whether X, Y, or Z values of the poses is the basis of the sorting.
Values:
- X: sort based on the X values of the poses.
- Y: sort based on the X values of the poses.
- Z: sort based on the X values of the poses.
../../../../../_images/xyz_descending.png

Parameter Tuning Example

If the Sort Order is set to Ascending and the Value for Sorting is set to X, then the sorting is based on X in ascending order. The data flow is as shown in Figure 2.

../../../../../_images/sort_ascending.png

Figure 2. Sorting based on X in ascending order

  1. Pose list to be sorted:

    PoseList:
    Size:3
    [
        [7, 0, 0, 1, 0, 0, 0],
        [2, 1, 0, 1, 0, 0, 0],
        [5, 2, 1, 1, 0, 0, 0]
    ]
    
  2. Sorted pose list:

    PoseList
    Size:3
    [
        [2, 1, 0, 1, 0, 0, 0],
        [5, 2, 1, 1, 0, 0, 0]
        [7, 0, 0, 1, 0, 0, 0],
    ]
    
  3. Index list of the sorted pose list:

    IndexList:
    Size:3
    [
        1,
        2,
        0
    ]
    

Comparison of Similar Steps

Sort Poses by XYZ Values sorts in the same way as Sort 3D Poses when the sortMethod parameter of Sort 3D Poses is set to SORT_BY_X, SORT_BY_Y, or SORT_BY_Z.

Sort Poses by XYZ Values has an additional output for the index list of the sorted pose list, as shown in Figure 3.

The output index list can be used to reorder data lists related to poses, such as masks and labels. The ordering is usually done by Sort Poses by XYZ Values together with Reorder Step.

In on-site applications, if it suffices to use Sort 3D Poses, please use Sort 3D Poses for higher project running speed.

../../../../../_images/compare_3d.png

Figure 3. Comparison of similar steps