X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=folded-ctf.git;a=blobdiff_plain;f=folding.cc;h=bdd93fec8507780bba465c283121af0cd22664f7;hp=34c785cbc59c316ab407942e37e880bc97f39dbe;hb=HEAD;hpb=d922ad61d35e9a6996730bec24b16f8bf7bc426c diff --git a/folding.cc b/folding.cc index 34c785c..bdd93fe 100644 --- a/folding.cc +++ b/folding.cc @@ -1,20 +1,26 @@ - -/////////////////////////////////////////////////////////////////////////// -// This program is free software: you can redistribute it and/or modify // -// it under the terms of the version 3 of the GNU General Public License // -// as published by the Free Software Foundation. // -// // -// This program is distributed in the hope that it will be useful, but // -// WITHOUT ANY WARRANTY; without even the implied warranty of // -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // -// General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program. If not, see . // -// // -// Written by Francois Fleuret, (C) IDIAP // -// Contact for comments & bug reports // -/////////////////////////////////////////////////////////////////////////// +/* + * folded-ctf is an implementation of the folded hierarchy of + * classifiers for object detection, developed by Francois Fleuret + * and Donald Geman. + * + * Copyright (c) 2008 Idiap Research Institute, http://www.idiap.ch/ + * Written by Francois Fleuret + * + * This file is part of folded-ctf. + * + * folded-ctf is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 3 as + * published by the Free Software Foundation. + * + * folded-ctf is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with folded-ctf. If not, see . + * + */ #include #include @@ -48,8 +54,6 @@ void check(bool condition, const char *message) { ////////////////////////////////////////////////////////////////////// int main(int argc, char **argv) { - char *new_argv[argc]; - int new_argc = 0; #ifdef DEBUG cout << endl; @@ -59,7 +63,11 @@ int main(int argc, char **argv) { cout << endl; #endif + char *new_argv[argc]; + int new_argc = 0; + cout << "-- ARGUMENTS ---------------------------------------------------------" << endl; + for(int i = 0; i < argc; i++) cout << (i > 0 ? " " : "") << argv[i] << (i < argc - 1 ? " \\" : "") << endl; @@ -144,19 +152,6 @@ int main(int argc, char **argv) { } - else if(strcmp(new_argv[c], "write-target-poses") == 0) { - check(main_pool, "No pool available."); - LabelledImage *image; - for(int p = 0; p < main_pool->nb_images(); p++) { - image = main_pool->grab_image(p); - for(int t = 0; t < image->nb_targets(); t++) { - cout << "IMAGE " << p << " TARGET " << t << endl; - image->get_target_pose(t)->print(&cout); - } - main_pool->release_image(p); - } - } - ////////////////////////////////////////////////////////////////////// else if(strcmp(new_argv[c], "train-detector") == 0) { @@ -176,25 +171,6 @@ int main(int argc, char **argv) { detector->compute_thresholds(validation_pool, global.wanted_true_positive_rate); } - else if(strcmp(new_argv[c], "check-hierarchy") == 0) { - cout << "-- CHECK HIERARCHY ---------------------------------------------------" << endl; - PoseCellHierarchy *h = new PoseCellHierarchy(hierarchy_pool); - cout << "Train incompatible poses " << h->nb_incompatible_poses(train_pool) << endl; - cout << "Validation incompatible poses " << h->nb_incompatible_poses(validation_pool) << endl; - delete h; - } - - ////////////////////////////////////////////////////////////////////// - - else if(strcmp(new_argv[c], "validate-detector") == 0) { - cout << "-- VALIDATE DETECTOR -------------------------------------------------" << endl; - - check(validation_pool, "No validation pool available."); - check(detector, "No detector."); - - print_decimated_error_rate(global.nb_levels - 1, validation_pool, detector); - } - ////////////////////////////////////////////////////////////////////// else if(strcmp(new_argv[c], "test-detector") == 0) { @@ -210,20 +186,6 @@ int main(int argc, char **argv) { } } - else if(strcmp(new_argv[c], "parse-images") == 0) { - cout << "-- PARSING IMAGES -----------------------------------------------------" << endl; - check(detector, "No detector."); - while(!cin.eof()) { - char image_name[buffer_size]; - cin.getline(image_name, buffer_size); - if(strlen(image_name) > 0) { - parse_scene(detector, image_name); - } - } - } - - ////////////////////////////////////////////////////////////////////// - else if(strcmp(new_argv[c], "sequence-test-detector") == 0) { cout << "-- SEQUENCE TEST DETECTOR --------------------------------------------" << endl; @@ -260,8 +222,6 @@ int main(int argc, char **argv) { detector->write(&out); } - ////////////////////////////////////////////////////////////////////// - else if(strcmp(new_argv[c], "read-detector") == 0) { cout << "-- READ DETECTOR -----------------------------------------------------" << endl; @@ -286,34 +246,6 @@ int main(int argc, char **argv) { write_pool_images_with_poses_and_referentials(train_pool, detector); } - else if(strcmp(new_argv[c], "produce-materials") == 0) { - cout << "-- PRODUCING MATERIALS -----------------------------------------------" << endl; - - check(hierarchy_pool, "No hierarchy pool available."); - check(test_pool, "No test pool available."); - - PoseCellHierarchy *hierarchy; - - cout << "Creating hierarchy" << endl; - - hierarchy = new PoseCellHierarchy(hierarchy_pool); - - LabelledImage *image; - for(int p = 0; p < test_pool->nb_images(); p++) { - image = test_pool->grab_image(p); - if(image->width() == 640 && image->height() == 480) { - PoseCellSet pcs; - hierarchy->add_root_cells(image, &pcs); - cout << "WE HAVE " << pcs.nb_cells() << " CELLS" << endl; - exit(0); - test_pool->release_image(p); - } - } - - delete hierarchy; - - } - ////////////////////////////////////////////////////////////////////// else {