# Post Process Weighing Algorithm

In order to post process multiple detections in a single frame to a usable single-number metric, we first use a post-processing weighing algorithm. After running the algorithm we send the value to the `EMA`

tracking algorithm. This page goes over the `Post-Processing Weighing Algorithm`

## Sigmoid-Logit Weighing

The output from the ML model will be in the format of:

```
[
[x1, xy1, x2, y2, conf, class], //what each index pertains to
[0.1, 0.15, 0.35, 0.45, 0.88, 1.0], //example values
...
]
```

The tensor of detections is then run through the following equations:

**Where:**

`X_c`

is the logit function modelled portion of the equation. This relates to the linear portion of the output (post simgoid function).- If there is only a X_c element of the output tensor, then the post-processed score will be a 1:1 linear representation of the input (e.g. no change to the value)
- If there are elements other than X_c, then the final output will not be 1:1 to the input
`Z`

is the combination of the Linear portion (X_c) and the remaining detection scores`C_i`

for`i = 1 to N`

`ϕ`

is the sigmoid function (𝜎) applied to`Z`

`𝛾`

is a constant value >= -1 used to weigh the remaining values with respect to the maximum detection value

## Visualization

Below are a few plots of the `post-processing weighing algorithm`

with varying values of `𝛾`

and `X_c`

. One value `C_i`

is added to the detections where `C_i = X_c - 0.05`