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

Function impl_test_potts_model

dlib/test/graph_cuts.cpp:466–504  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464
465 template <typename potts_prob>
466 void impl_test_potts_model (
467 potts_prob& p
468 )
469 {
470 using namespace std;
471 double brute_force_score;
472 double graph_cut_score;
473
474 {
475 potts_prob temp(p);
476 brute_force_potts_model(temp);
477
478 for (unsigned long i = 0; i < temp.number_of_nodes(); ++i)
479 {
480 dlog << LTRACE << "node " << i << ": "<< (int)temp.get_label(i);
481 }
482 brute_force_score = potts_model_score(temp);
483 dlog << LTRACE << "brute force score: "<< brute_force_score;
484 }
485 dlog << LTRACE << "******************";
486
487 {
488 potts_prob temp(p);
489 find_max_factor_graph_potts(temp);
490
491 for (unsigned long i = 0; i < temp.number_of_nodes(); ++i)
492 {
493 dlog << LTRACE << "node " << i << ": "<< (int)temp.get_label(i);
494 }
495 graph_cut_score = potts_model_score(temp);
496 dlog << LTRACE << "graph cut score: "<< graph_cut_score;
497 }
498
499 DLIB_TEST_MSG(graph_cut_score == brute_force_score, std::abs(graph_cut_score - brute_force_score));
500
501 dlog << LTRACE << "##################";
502 dlog << LTRACE << "##################";
503 dlog << LTRACE << "##################";
504 }
505
506// ----------------------------------------------------------------------------------------
507// ----------------------------------------------------------------------------------------

Callers 1

perform_testMethod · 0.85

Calls 6

brute_force_potts_modelFunction · 0.85
potts_model_scoreFunction · 0.85
absFunction · 0.85
number_of_nodesMethod · 0.45
get_labelMethod · 0.45

Tested by

no test coverage detected