16 vec_float_t res(nNodes);
19 for (
size_t n = 0; n < nNodes; n++) {
22 sort(pot, srt, cv::SortFlags::SORT_EVERY_COLUMN | cv::SortFlags::SORT_DESCENDING);
24 float max = srt.at<
float>(0, 0);
25 float second_max = srt.at<
float>(1, 0);
27 res[n] = (max == 0) ? 0.0f : 1.0f - second_max / max;
36 vec_float_t res(nNodes);
39 for (
size_t n = 0; n < nNodes; n++) {
41 res[n] = pot.at<
float>(state, 0);
virtual void infer(unsigned int nIt=1)=0
Inference.
virtual vec_byte_t decode(Mat &lossMatrix=EmptyMat) const
Approximate decoding.
virtual size_t getNumNodes(void) const =0
Returns the number of nodes in the graph.
vec_float_t getPotentials(byte state) const
Returns the potnetials for the selected state (class)
virtual void getNode(size_t node, Mat &pot) const =0
Returns the node potential.
vec_byte_t decode(unsigned int nIt=0, Mat &lossMatrix=EmptyMat)
Approximate decoding.
CGraph & getGraph(void) const
Returns the reference to the graph.
vec_float_t getConfidence(void) const
Returns the confidence of the perdiction.