| 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 | // ---------------------------------------------------------------------------------------- |
no test coverage detected