STM32N6 NPU Deployment — Politecnico di Milano  1.0
Documentation for Neural Network Deployment on STM32N6 NPU - Politecnico di Milano 2024-2025
postprocess Namespace Reference

Functions

def heatmaps_spe_postprocess (tf.Tensor tensor)
 
def spe_postprocess (tf.Tensor tensor)
 
def _padded_nms (tf.Tensor tensor, int max_output_size, float iou_threshold, float score_threshold)
 
def yolo_mpe_postprocess (tf.Tensor tensor, int max_output_size=20, float iou_threshold=0.7, float score_threshold=0.25)
 
def hand_landmarks_postprocess ([tf.Tensor] tensor)
 
def head_landmarks_postprocess ([tf.Tensor] tensor)
 

Function Documentation

◆ _padded_nms()

def postprocess._padded_nms ( tf.Tensor  tensor,
int  max_output_size,
float  iou_threshold,
float  score_threshold 
)
private
Function used to apply NMS on each image of the batch independently

Args
    tensor          (tf.Tensor): shape (5+keypoints*3, num_boxes) FLOAT32 outputs of the YOLO multi pose estimation models
    max_output_size (tf.Tensor): shape (1,) INT32 max number of detections per image
    iou_threshold   (tf.Tensor): shape (1,) FLOAT32 threshold for NMS iou
    score_threshold (tf.Tensor): shape (1,) FLOAT32 threshold to filter detections under a certain score

Returns:
    detection       (tf.Tensor): shape (max_output_size, 5+keypoints*3) FLOAT32 bounding boxes + (x,y,conf) values for all keypoints of all detected persons

Definition at line 80 of file postprocess.py.

Referenced by yolo_mpe_postprocess().

Here is the caller graph for this function:

◆ hand_landmarks_postprocess()

def postprocess.hand_landmarks_postprocess ( [tf.Tensor]  tensor)
Post-process for the hand landmarks use-case

Args
    tensor  list(tf.Tensor): shape [(batch,1),(batch, keypoints*3),(batch,1),(batch, keypoints*3)] FLOAT32 outputs of the hand landmarks

Returns:
    det      (tf.Tensor): shape (batch, keypoints*3) FLOAT32 3D detections of the hand landmarks in pixels
    norm_det (tf.Tensor): shape (batch, keypoints*3) FLOAT32 3D detections of the hand landmarks centered reduced (invariant of hand size and position)
    htype    (tf.Tensor): shape (batch,) FLOAT32 type of hand (right or left) if near 0 -> left, if near 1 -> right
    hprob    (tf.Tensor): shape (batch,) FLOAT32 presence probability of the hand

Definition at line 153 of file postprocess.py.

◆ head_landmarks_postprocess()

def postprocess.head_landmarks_postprocess ( [tf.Tensor]  tensor)
Post-process for the head landmarks use-case

Args
    tensor  list(tf.Tensor): shape [(batch,1,1,keypoints*3),(batch,1,1),(batch,1)] FLOAT32 outputs of the head landmarks

Returns:
    det      (tf.Tensor): shape (batch, keypoints*3) FLOAT32 3D detections of the head landmarks in pixels
    hprob    (tf.Tensor): shape (batch,) FLOAT32 presence probability of the head

Definition at line 192 of file postprocess.py.

◆ heatmaps_spe_postprocess()

def postprocess.heatmaps_spe_postprocess ( tf.Tensor  tensor)
Post-process for the single pose estimation heatmaps use-case

Args
    tensor    (tf.Tensor): shape (batch, res, res, keypoints) FLOAT32 heatmaps outputs of the single pose estimation models

Returns:
    detection (tf.Tensor): shape (batch, 1, keypoints*3) FLOAT32 the (x,y,conf) values of all keypoints for the single person

Definition at line 30 of file postprocess.py.

Referenced by evaluate.evaluate(), and metrics.single_pose_heatmaps_oks().

Here is the caller graph for this function:

◆ spe_postprocess()

def postprocess.spe_postprocess ( tf.Tensor  tensor)
Post-process for the single pose estimation use-case

Args
    tensor    (tf.Tensor): shape (batch, 1, keypoints, 3) FLOAT32 the (x,y,conf) values of all keypoints but in a different format

Returns:
    detection (tf.Tensor): shape (batch, 1, keypoints*3) FLOAT32 the (x,y,conf) values of all keypoints for the single person

Definition at line 57 of file postprocess.py.

Referenced by evaluate.evaluate().

Here is the caller graph for this function:

◆ yolo_mpe_postprocess()

def postprocess.yolo_mpe_postprocess ( tf.Tensor  tensor,
int  max_output_size = 20,
float  iou_threshold = 0.7,
float  score_threshold = 0.25 
)
Post-process for the multi pose estimation use-case

Args
    tensor          (tf.Tensor): shape (batch, 5+keypoints*3, num_boxes) FLOAT32 outputs of the YOLO multi pose estimation models
    max_output_size (tf.Tensor): shape (1,) INT32 max number of detections per image
    iou_threshold   (tf.Tensor): shape (1,) FLOAT32 threshold for NMS iou
    score_threshold (tf.Tensor): shape (1,) FLOAT32 threshold to filter detections under a certain score

Returns:
    detections      (tf.Tensor): shape (batch, max_output_size, 5+keypoints*3) FLOAT32 values for all keypoints of all detected persons

Definition at line 127 of file postprocess.py.

References _padded_nms().

Referenced by evaluate.evaluate().

Here is the call graph for this function:
Here is the caller graph for this function: