-
-///////////////////////////////////////////////////////////////////////////
-// 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 <http://www.gnu.org/licenses/>. //
-// //
-// Written by Francois Fleuret, (C) IDIAP //
-// Contact <francois.fleuret@idiap.ch> 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 <francois.fleuret@idiap.ch>
+ *
+ * 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 <http://www.gnu.org/licenses/>.
+ *
+ */
#include <iostream>
#include <fstream>
//////////////////////////////////////////////////////////////////////
int main(int argc, char **argv) {
- char *new_argv[argc];
- int new_argc = 0;
#ifdef DEBUG
cout << endl;
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;
}
- 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) {
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) {
}
}
- 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;
detector->write(&out);
}
- //////////////////////////////////////////////////////////////////////
-
else if(strcmp(new_argv[c], "read-detector") == 0) {
cout << "-- READ DETECTOR -----------------------------------------------------" << endl;
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 {