Write a class to track multi-class object probability
Description
In order to track the state of an object we need some form of, ideally probabilistic, state tracking. This issue tracks the creation of a class that would manage this.
Purpose
The purpose of this class is to allow maintaining and updating a probability distribution over a number of classes that the object can be assigned. For example, it can be an array of [PEDESTRIAN, CAR, CONE]
with corresponding probabilities [0.1, 0.8, 0.1]
. These probabilities should be updated from new observations.
Desired Behavior
There should be the following operations defined over the class in question:
- an update function that allows updating all the current probabilities
- a way to get
n
most certain classes
Possible implementations
I can see a couple of ways to address this. In the end, all of them are related to some form of a bayesian filter:
- We can reuse kalman filter. We can define variables for each class that would inherit from the existing
Variable
struct, so we would get a state vector smth likeStateVector<PEDESTRIAN, CAR, CONE> state{};
. We can initialize them uniformly so that they sum up to 1. We can then update this state with a characteristic vector that contains the observation probabilities for the state variables. We probably don't to predict the state forward. - We can implement this as a vector of static state binary Bayes filters (as shown on slide 14 in this presentation) for each class that we would like to estimate. This way all the variables would be independent from each other but an observation would bring the likelihood of the observed class closer to 1 and the likelihood of all other classes closer to 0.
- We can implement a variant of a histogram filter
- Hand-roll a tailored filter for the task
Definition of Done
-
A class that is able to update such a distribution is created. -
Or, if an existing class is used, a new test that showcases this behavior is written