MCPcopy Create free account
hub / github.com/davisking/dlib / perform_test

Method perform_test

dlib/test/graph_cuts.cpp:1151–1209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1149 dlib::rand rnd;
1150
1151 void perform_test (
1152 )
1153 {
1154 test_potts_pair_grid();
1155 test_inf();
1156
1157 for (int i = 0; i < 500; ++i)
1158 {
1159 array2d<unsigned char> labels, brute_labels;
1160 test_potts_grid_problem prob(i);
1161 find_max_factor_graph_potts(prob, labels);
1162 brute_force_potts_grid_problem(prob, brute_labels);
1163
1164 DLIB_TEST(labels.nr() == brute_labels.nr());
1165 DLIB_TEST(labels.nc() == brute_labels.nc());
1166 for (long r = 0; r < labels.nr(); ++r)
1167 {
1168 for (long c = 0; c < labels.nc(); ++c)
1169 {
1170 bool normal = (labels[r][c] != 0);
1171 bool brute = (brute_labels[r][c] != 0);
1172 DLIB_TEST(normal == brute);
1173 }
1174 }
1175 }
1176
1177 for (int i = 0; i < 1000; ++i)
1178 {
1179 print_spinner();
1180 dlog << LTRACE << "test_grpah_cuts<short> iter: " << i;
1181 test_graph_cuts<min_cut,short>(rnd);
1182 print_spinner();
1183 dlog << LTRACE << "test_grpah_cuts<double> iter: " << i;
1184 test_graph_cuts<min_cut,double>(rnd);
1185 }
1186
1187
1188 for (int k = 0; k < 300; ++k)
1189 {
1190 dlog << LTRACE << "image_potts_problem iter " << k;
1191 print_spinner();
1192 image_potts_problem p(3,3, rnd);
1193 impl_test_potts_model(p);
1194 }
1195 for (int k = 0; k < 300; ++k)
1196 {
1197 dlog << LTRACE << "dense_potts_problem iter " << k;
1198 print_spinner();
1199 dense_potts_problem p(6, rnd);
1200 impl_test_potts_model(p);
1201 }
1202
1203 for (int k = 0; k < 300; ++k)
1204 {
1205 dlog << LTRACE << "dense_potts_problem iter " << k;
1206 print_spinner();
1207 test_graph_potts_model(rnd);
1208 }

Callers

nothing calls this directly

Calls 9

test_potts_pair_gridFunction · 0.85
test_infFunction · 0.85
print_spinnerFunction · 0.85
impl_test_potts_modelFunction · 0.85
test_graph_potts_modelFunction · 0.85
nrMethod · 0.45
ncMethod · 0.45

Tested by

no test coverage detected