NVlabs / AL-MDN

Official pytorch implementation of Active Learning for deep object detection via probabilistic modeling (ICCV 2021)

Home Page:https://openaccess.thecvf.com/content/ICCV2021/html/Choi_Active_Learning_for_Deep_Object_Detection_via_Probabilistic_Modeling_ICCV_2021_paper.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to output aleatoric and epistemic uncertainties associated to the class

BrenoAV opened this issue · comments

Greetings,

I was trying to print out the uncertainties just the way it is shown in Figure 3 from the paper:

uncertainties

Where should I tweak the code, so that I can output those 4 uncertainty values for each image?

In /layers/functions/detection_gmm.py there's one output variable with should contain uncertainties, but I wasn't able to understand the output. Is there anything I'm missing/misunderstanding?

Hello @BrenoAV
As you can see this line, output contains scores, box coordinates, aleatoric & epistemic uncertainties of each task.
You can print out each uncertainty value using detections variable, like scores and box coordinates.
To output normalized values, you need to know the mean and variance of each uncertainty distribution for the dataset.
For doing this, you can use this function.

It makes sense now for me, thank you very much @jwchoi384

hello please if you have a concrete example how to recover them for each image?
@jwchoi384 @BrenoAV

What I do understand, please correct me if I'm wrong.

You can take these values from here layers/functions/detection_gmm.py:

uc1

For example, in the demo.py file... When you test some image you can use the while loop to obtain the uncertainty for each bbox, something like this:

max_loc_al_uc = torch.max(detections[0][i][j][5:9]) # 4 values (four coordinates values)
max_loc_ep_uc = torch.max(detections[0][i][j][9:13]) # 4 values (four coordinates values)
cl_al_uc = torch.max(detections[0][i][j][13:14]) # 1 value
cl_ep_uc = torch.max(detections[0][i][j][14:15]) # 1 value

Thank you @BrenoAV very much for your answer indeed the same thing that I understood but I have a small concern concerning the four values ​​for the random and epistimological localisation why it sends 4 values ​​instead of a single value as the case of the classification. and for the function can we use it if we want to select a set of images to label ?

For the localization, the 4 values are the uncertainty about the center, height, and weight {x, y, w, h}. On pg. 4 of the paper in section 3.3 Scoring Function: "[...] For localization, $u^{ij}$ is the maximum value over the 4 bounding box outputs. [...]"

And in the function you cited, you want to take the labeled_set because they have high score values, labeling them and continue the active learning loop.

thank you once again @BrenoAV for your help and support now things seem understandable.