From aed34255065b18c445d096f51bd2091833810a81 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Thu, 16 Oct 2008 22:54:55 +0200 Subject: [PATCH] automatic commit --- README.txt | 21 ++++++++++-------- error_rates.cc | 1 - global.cc | 2 +- pose_cell_hierarchy.cc | 6 +++--- pose_cell_hierarchy.h | 2 +- rgb_image_subpixel.cc | 48 +++++++++++++++++++++++++++++------------- rgb_image_subpixel.h | 6 +++--- 7 files changed, 53 insertions(+), 33 deletions(-) diff --git a/README.txt b/README.txt index c4717a0..3b37296 100644 --- a/README.txt +++ b/README.txt @@ -8,7 +8,7 @@ INTRODUCTION F. Fleuret and D. Geman, "Stationary Features and Cat Detection", Journal of Machine Learning Research (JMLR), 2008, to appear. - Please use that citation and the original URL + Please use that citation and the URL http://www.idiap.ch/folded-ctf @@ -55,8 +55,13 @@ INSTALLATION on several machines as long as they see the same result directory. When all or some of the experimental rounds are over, you can - generate the ROC curves by invoking the ./graph.sh script. You need - a fairly recent version of Gnuplot. + generate ROC curves by invoking ./graph.sh script. You need a fairly + recent version of Gnuplot. + + If you pass the argument "pics" to the ./graphs.sh script, it will + save images from the data set with the ground truth plotted on them, + the pose-indexed referential, and examples of the pose-indexed + feature windows. This program was developed on Debian GNU/Linux computers with the following main tool versions @@ -73,14 +78,12 @@ EXECUTING THE PROGRAM --------------------- The main command has to be invoked with a list of parameter values, - followed by commands to execute. - - To set the value of a parameter, just add an argument of the form - --parameter-name=value before the commands that should take it into - account. + followed by commands to execute. A parameter value is modified by + adding an argument of the form --parameter-name=value. For instance, to open a scene pool ./something.pool, train a - detector and save it, you would do + detector and save it with all other parameters kept at their default + value, you would do ./folding --pool-name=./something.pool open-pool train-detector write-detector diff --git a/error_rates.cc b/error_rates.cc index f028f17..0743fa5 100644 --- a/error_rates.cc +++ b/error_rates.cc @@ -82,7 +82,6 @@ void print_decimated_error_rate(int level, LabelledImagePool *pool, Detector *de if(global.write_parse_images) { char buffer[buffer_size]; sprintf(buffer, "%s/parse-%04d.png", global.result_path, i); - cout << "LEVEL = " << level << endl; write_image_with_detections(buffer, image, &result_cell_set, level); diff --git a/global.cc b/global.cc index 76543f8..a3ab0dc 100644 --- a/global.cc +++ b/global.cc @@ -103,7 +103,7 @@ void Global::init_parser(ParamParser *parser) { parser->add_association("min-head-radius", "25", false); // What is the maximum size of the heads to detect. parser->add_association("max-head-radius", "200", false); - // How many translation cell for one scale when generating the "top + // How many translation cell per radius when generating the "top // level" cells for an image. parser->add_association("root-cell-nb-xy-per-radius", "5", false); diff --git a/pose_cell_hierarchy.cc b/pose_cell_hierarchy.cc index e12a32f..273a186 100644 --- a/pose_cell_hierarchy.cc +++ b/pose_cell_hierarchy.cc @@ -29,7 +29,7 @@ PoseCellHierarchy::PoseCellHierarchy(LabelledImagePool *train_pool) { _nb_levels = global.nb_levels; _min_head_radius = global.min_head_radius; _max_head_radius = global.max_head_radius; - _root_cell_nb_xy_per_scale = global.root_cell_nb_xy_per_radius; + _root_cell_nb_xy_per_radius = global.root_cell_nb_xy_per_radius; LabelledImage *image; int nb_total_targets = 0; @@ -302,7 +302,7 @@ int PoseCellHierarchy::nb_incompatible_poses(LabelledImagePool *pool) { void PoseCellHierarchy::write(ostream *os) { write_var(os, &_min_head_radius); write_var(os, &_max_head_radius); - write_var(os, &_root_cell_nb_xy_per_scale); + write_var(os, &_root_cell_nb_xy_per_radius); write_var(os, &_nb_belly_cells); for(int k = 0; k < _nb_belly_cells; k++) write_var(os, &_belly_cells[k]); @@ -312,7 +312,7 @@ void PoseCellHierarchy::read(istream *is) { delete[] _belly_cells; read_var(is, &_min_head_radius); read_var(is, &_max_head_radius); - read_var(is, &_root_cell_nb_xy_per_scale); + read_var(is, &_root_cell_nb_xy_per_radius); read_var(is, &_nb_belly_cells); delete[] _belly_cells; _belly_cells = new RelativeBellyPoseCell[_nb_belly_cells]; diff --git a/pose_cell_hierarchy.h b/pose_cell_hierarchy.h index a9461b2..c04e3b0 100644 --- a/pose_cell_hierarchy.h +++ b/pose_cell_hierarchy.h @@ -49,7 +49,7 @@ class PoseCellHierarchy { int _nb_levels; scalar_t _min_head_radius; scalar_t _max_head_radius; - int _root_cell_nb_xy_per_scale; + int _root_cell_nb_xy_per_radius; int _nb_belly_cells; diff --git a/rgb_image_subpixel.cc b/rgb_image_subpixel.cc index 7b65504..b798bc1 100644 --- a/rgb_image_subpixel.cc +++ b/rgb_image_subpixel.cc @@ -20,15 +20,15 @@ #include "rgb_image_subpixel.h" -RGBImageSubpixel::RGBImageSubpixel(int width, int height) : RGBImage(width * _scale, height* _scale) { } +RGBImageSubpixel::RGBImageSubpixel(int width, int height) : RGBImage(width * scale, height* scale) { } -RGBImageSubpixel::RGBImageSubpixel(RGBImage *image) : RGBImage(image->width() * _scale, image->height() * _scale) { +RGBImageSubpixel::RGBImageSubpixel(RGBImage *image) : RGBImage(image->width() * scale, image->height() * scale) { for(int y = 0; y < _height; y++) { for(int x = 0; x < _width; x++) { set_pixel(x, y, - image->pixel(x / _scale, y / _scale, RGBImage::RED), - image->pixel(x / _scale, y / _scale, RGBImage::GREEN), - image->pixel(x / _scale, y / _scale, RGBImage::BLUE)); + image->pixel(x / scale, y / scale, RGBImage::RED), + image->pixel(x / scale, y / scale, RGBImage::GREEN), + image->pixel(x / scale, y / scale, RGBImage::BLUE)); } } } @@ -40,12 +40,12 @@ void RGBImageSubpixel::read_png(const char *filename) { } void RGBImageSubpixel::write_png(const char *filename) { - RGBImage tmp(_width / _scale, _height / _scale); - for(int y = 0; y < _height / _scale; y++) { - for(int x = 0; x < _width / _scale; x++) { + RGBImage tmp(_width / scale, _height / scale); + for(int y = 0; y < _height / scale; y++) { + for(int x = 0; x < _width / scale; x++) { int sr = 0, sg = 0, sb = 0; - for(int yy = y * _scale; yy < (y + 1) * _scale; yy++) { - for(int xx = x * _scale; xx < (x + 1) * _scale; xx++) { + for(int yy = y * scale; yy < (y + 1) * scale; yy++) { + for(int xx = x * scale; xx < (x + 1) * scale; xx++) { sr += int(_bit_plans[RED][yy][xx]); sg += int(_bit_plans[GREEN][yy][xx]); sb += int(_bit_plans[BLUE][yy][xx]); @@ -53,7 +53,7 @@ void RGBImageSubpixel::write_png(const char *filename) { } tmp.set_pixel(x, y, - sr / (_scale * _scale), sg / (_scale * _scale), sb / (_scale * _scale)); + sr / (scale * scale), sg / (scale * scale), sb / (scale * scale)); } } tmp.write_png(filename); @@ -65,15 +65,33 @@ void RGBImageSubpixel::read_jpg(const char *filename) { } void RGBImageSubpixel::write_jpg(const char *filename, int quality) { - abort(); + RGBImage tmp(_width / scale, _height / scale); + + for(int y = 0; y < _height / scale; y++) { + for(int x = 0; x < _width / scale; x++) { + int sr = 0, sg = 0, sb = 0; + for(int yy = y * scale; yy < (y + 1) * scale; yy++) { + for(int xx = x * scale; xx < (x + 1) * scale; xx++) { + sr += int(_bit_plans[RED][yy][xx]); + sg += int(_bit_plans[GREEN][yy][xx]); + sb += int(_bit_plans[BLUE][yy][xx]); + } + } + + tmp.set_pixel(x, y, + sr / (scale * scale), sg / (scale * scale), sb / (scale * scale)); + } + } + + tmp.write_jpg(filename, quality); } void RGBImageSubpixel::draw_line(int thickness, unsigned char r, unsigned char g, unsigned char b, scalar_t x0, scalar_t y0, scalar_t x1, scalar_t y1) { - RGBImage::draw_line(int(thickness * _scale), + RGBImage::draw_line(int(thickness * scale), r, g, b, - x0 * _scale + _scale/2, y0 * _scale + _scale/2, - x1 * _scale + _scale/2, y1 * _scale + _scale/2); + x0 * scale + scale/2, y0 * scale + scale/2, + x1 * scale + scale/2, y1 * scale + scale/2); } diff --git a/rgb_image_subpixel.h b/rgb_image_subpixel.h index 55618c6..57d41e2 100644 --- a/rgb_image_subpixel.h +++ b/rgb_image_subpixel.h @@ -32,15 +32,15 @@ #include "rgb_image.h" class RGBImageSubpixel : public RGBImage { - static const int _scale = 8; + static const int scale = 8; public: RGBImageSubpixel(int width, int height); RGBImageSubpixel(RGBImage *image); virtual ~RGBImageSubpixel(); - inline int width() const { return _width / _scale; } - inline int height() const { return _height / _scale; } + inline int width() const { return _width / scale; } + inline int height() const { return _height / scale; } virtual void read_png(const char *filename); virtual void write_png(const char *filename); -- 2.39.5