Commit 26120394 authored by Davis King's avatar Davis King

Updated find_max_factor_graph_potts() to correctly say you can use infinite weights

for the factor_value_disagreement() values since the code actually supports this.
parent 346ec3b3
...@@ -159,7 +159,9 @@ namespace dlib ...@@ -159,7 +159,9 @@ namespace dlib
different labels. Larger values indicate a larger penalty. different labels. Larger values indicate a larger penalty.
- this function is symmetric. That is, it is true that: - this function is symmetric. That is, it is true that:
factor_value_disagreement(i,j) == factor_value_disagreement(j,i) factor_value_disagreement(i,j) == factor_value_disagreement(j,i)
- The return value should be a finite value. - It is valid for the returned value to be positive infinity. Returning
infinity indicates that the idx1-th and idx2-th nodes must share the same
label.
!*/ !*/
}; };
...@@ -248,7 +250,9 @@ namespace dlib ...@@ -248,7 +250,9 @@ namespace dlib
different labels. Larger values indicate a larger penalty. different labels. Larger values indicate a larger penalty.
- this function is symmetric. That is, it is true that: - this function is symmetric. That is, it is true that:
factor_value_disagreement(i,j) == factor_value_disagreement(j,i) factor_value_disagreement(i,j) == factor_value_disagreement(j,i)
- The return value should be a finite value. - It is valid for the returned value to be positive infinity. Returning
infinity indicates that the idx1-th and idx2-th nodes must share the same
label.
!*/ !*/
}; };
...@@ -498,7 +502,9 @@ namespace dlib ...@@ -498,7 +502,9 @@ namespace dlib
penalty. penalty.
- this function is symmetric. That is, it is true that: - this function is symmetric. That is, it is true that:
factor_value_disagreement(i,j) == factor_value_disagreement(j,i) factor_value_disagreement(i,j) == factor_value_disagreement(j,i)
- The return value should be a finite value. - It is valid for the returned value to be positive infinity. Returning
infinity indicates that the idx1-th and idx2-th nodes must share the same
label.
!*/ !*/
}; };
...@@ -559,7 +565,9 @@ namespace dlib ...@@ -559,7 +565,9 @@ namespace dlib
penalty. penalty.
- this function is symmetric. That is, it is true that: - this function is symmetric. That is, it is true that:
factor_value_disagreement(i,j) == factor_value_disagreement(j,i) factor_value_disagreement(i,j) == factor_value_disagreement(j,i)
- The return value should be a finite value. - It is valid for the returned value to be positive infinity. Returning
infinity indicates that the idx1-th and idx2-th nodes must share the same
label.
!*/ !*/
}; };
......
...@@ -1009,6 +1009,63 @@ namespace ...@@ -1009,6 +1009,63 @@ namespace
DLIB_TEST(labels[1] != 0); DLIB_TEST(labels[1] != 0);
DLIB_TEST(labels[2] != 0); DLIB_TEST(labels[2] != 0);
DLIB_TEST(labels[3] != 0); DLIB_TEST(labels[3] != 0);
// --------------------------
g.node(0).data = -10;
g.node(1).data = std::numeric_limits<double>::infinity();
g.node(2).data = 0;
g.node(3).data = 0.1;
edge(g,0,1) = std::numeric_limits<double>::infinity();
edge(g,1,2) = std::numeric_limits<double>::infinity();
edge(g,2,3) = std::numeric_limits<double>::infinity();
edge(g,3,0) = std::numeric_limits<double>::infinity();
find_max_factor_graph_potts(g, labels);
DLIB_TEST(labels[0] != 0);
DLIB_TEST(labels[1] != 0);
DLIB_TEST(labels[2] != 0);
DLIB_TEST(labels[3] != 0);
// --------------------------
g.node(0).data = 10;
g.node(1).data = -std::numeric_limits<double>::infinity();
g.node(2).data = 20.05;
g.node(3).data = -0.1;
edge(g,0,1) = std::numeric_limits<double>::infinity();
edge(g,1,2) = 10;
edge(g,2,3) = std::numeric_limits<double>::infinity();
edge(g,3,0) = 10;
find_max_factor_graph_potts(g, labels);
DLIB_TEST(labels[0] == 0);
DLIB_TEST(labels[1] == 0);
DLIB_TEST(labels[2] == 0);
DLIB_TEST(labels[3] == 0);
// --------------------------
g.node(0).data = 10;
g.node(1).data = -std::numeric_limits<double>::infinity();
g.node(2).data = 20.2;
g.node(3).data = -0.1;
edge(g,0,1) = std::numeric_limits<double>::infinity();
edge(g,1,2) = 10;
edge(g,2,3) = std::numeric_limits<double>::infinity();
edge(g,3,0) = 10;
find_max_factor_graph_potts(g, labels);
DLIB_TEST(labels[0] == 0);
DLIB_TEST(labels[1] == 0);
DLIB_TEST(labels[2] != 0);
DLIB_TEST(labels[3] != 0);
} }
// ---------------------------------------------------------------------------------------- // ----------------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment