Direct Graphical Models  v.1.6.0
Collaboration diagram for Evaluation:


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


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) {
if (Pixel[i].predicted_state == state) {
AP = AP + numCoincidences / i;
AP = AP / nRelevants;

where AP stays for Average Precision.

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.cols * gtImg.rows);
stateThe state (class) for which the Average Precision is calculated
The Average Precision value

Definition at line 6 of file AveragePrecision.cpp.