Direct Graphical Models  v.1.6.0
Evaluation
Collaboration diagram for Evaluation:

Classes

class  DirectGraphicalModels::CCMat
 Confusion matrix class. More...
 

Functions

float DirectGraphicalModels::getAveragePrecision (const vec_byte_t &predictions, const vec_float_t &potentials, const vec_byte_t &gt, byte state)
 Returns Average Precision for the selected state (class) state. More...
 

Detailed Description

Function Documentation

◆ getAveragePrecision()

float DirectGraphicalModels::getAveragePrecision ( const vec_byte_t &  predictions,
const vec_float_t &  potentials,
const vec_byte_t &  gt,
byte  state 
)

Returns Average Precision for the selected state (class) state.

This function analyses 3 values of every image pixel, namely the predicted state, the groundtruth state and the potential of the pixel to be the class state, passed to the function via the arguments: predictions, gt and potentials, respectively. First, the pixels are sorted by the potentials in descending order. After that, the following algorithm is applied:

for (int i = 1; i <= numPixels; i++)
if (Pixel[i].groundtruth_state == state) {
numRelevants++;
if (Pixel[i].predicted_state == state) {
numCoincidences++;
AP = AP + numCoincidences / i;
}
}
AP = AP / nRelevants;

where AP stays for Average Precision.

Parameters
predictionsThe most probable configuration, returned by the CDecode::decode() function
potentialsThe potential values for each node of the graph, returned by the CInfer::getPotentials(state) function
gtThe groundtruth values for each node of the graph. May be converted from a groundtruth image as follows:
vec_byte_t gt(gtImg.data, gtImg.data + gtImg.cols * gtImg.rows);
stateThe state (class) for which the Average Precision is calculated
Returns
The Average Precision value

Definition at line 6 of file AveragePrecision.cpp.