X-Git-Url: https://www.fleuret.org/cgi-bin/gitweb/gitweb.cgi?p=folded-ctf.git;a=blobdiff_plain;f=pose_cell_hierarchy.cc;h=6ce933f7e640bd70cb465a829298ac5720d64d71;hp=0816f3a2819ce94a2e43bd71a8c2b1eaa4e7b7ec;hb=f7e3efe41ffb65d89e8f2ce814c23ff90ad24f34;hpb=d922ad61d35e9a6996730bec24b16f8bf7bc426c diff --git a/pose_cell_hierarchy.cc b/pose_cell_hierarchy.cc index 0816f3a..6ce933f 100644 --- a/pose_cell_hierarchy.cc +++ b/pose_cell_hierarchy.cc @@ -53,16 +53,16 @@ PoseCellHierarchy::PoseCellHierarchy(LabelledImagePool *train_pool) { cell_set.get_containing_cell(&pose)->get_centroid(&coarse); - targets[u]._body_xc.set((pose._body_xc - coarse._head_xc) / coarse._head_radius); - targets[u]._body_yc.set((pose._body_yc - coarse._head_yc) / coarse._head_radius); + targets[u]._body_xc.set((pose._belly_xc - coarse._head_xc) / coarse._head_radius); + targets[u]._body_yc.set((pose._belly_yc - coarse._head_yc) / coarse._head_radius); u++; pose.horizontal_flip(image->width()); cell_set.get_containing_cell(&pose)->get_centroid(&coarse); - targets[u]._body_xc.set((pose._body_xc - coarse._head_xc) / coarse._head_radius); - targets[u]._body_yc.set((pose._body_yc - coarse._head_yc) / coarse._head_radius); + targets[u]._body_xc.set((pose._belly_xc - coarse._head_xc) / coarse._head_radius); + targets[u]._body_yc.set((pose._belly_yc - coarse._head_yc) / coarse._head_radius); u++; } @@ -180,52 +180,6 @@ PoseCellHierarchy::PoseCellHierarchy(LabelledImagePool *train_pool) { mother._body_xc.set(x, x + body_resolution); mother._body_yc.set(y, y + body_resolution); - // scalar_t dist_min = body_resolution; - scalar_t dist_min = 1e6; - - int nb_got; - - Gaussian dist_body_radius_1, dist_body_radius_2, dist_body_tilt; - - do { - - nb_got = 0; - - for(int t = 0; t < nb_total_targets; t++) { - - scalar_t dist = - sqrt(sq(targets[t]._body_xc.middle() - x - body_resolution / 2) + - sq(targets[t]._body_yc.middle() - y - body_resolution / 2)); - - if(dist <= dist_min) { - dist_body_radius_1.add_sample(targets[t]._body_radius_1.middle()); - dist_body_radius_2.add_sample(targets[t]._body_radius_2.middle()); - dist_body_tilt.add_sample(targets[t]._body_tilt.middle()); - nb_got++; - } - - } - - dist_min *= 2.0; - } while(nb_got < min(100, nb_total_targets)); - - scalar_t zeta = 4; - - mother._body_radius_1.set(dist_body_radius_1.expectation() - - zeta * dist_body_radius_1.standard_deviation(), - dist_body_radius_1.expectation() + - zeta * dist_body_radius_1.standard_deviation()); - - mother._body_radius_2.set(dist_body_radius_2.expectation() - - zeta * dist_body_radius_2.standard_deviation(), - dist_body_radius_2.expectation() + - zeta * dist_body_radius_2.standard_deviation()); - - mother._body_tilt.set(dist_body_tilt.expectation() - - zeta * dist_body_tilt.standard_deviation(), - dist_body_tilt.expectation() + - zeta * dist_body_tilt.standard_deviation()); - _body_cells[k++] = mother; } } @@ -279,10 +233,10 @@ void PoseCellHierarchy::add_root_cells(Image *image, PoseCellSet *cell_set) { cell._head_xc.max = x + cell_xy_size; cell._head_yc.min = y; cell._head_yc.max = y + cell_xy_size; - cell._body_xc.min = cell._head_xc.min - pseudo_infty; - cell._body_xc.max = cell._head_xc.max + pseudo_infty; - cell._body_yc.min = cell._head_yc.min - pseudo_infty; - cell._body_yc.max = cell._head_yc.max + pseudo_infty; + cell._belly_xc.min = cell._head_xc.min - pseudo_infty; + cell._belly_xc.max = cell._head_xc.max + pseudo_infty; + cell._belly_yc.min = cell._head_yc.min - pseudo_infty; + cell._belly_yc.max = cell._head_yc.max + pseudo_infty; cell_set->add_cell(&cell); } } @@ -301,10 +255,10 @@ void PoseCellHierarchy::add_subcells(int level, PoseCell *root, scalar_t x = (cell._head_xc.min + cell._head_xc.max) / 2.0; scalar_t y = (cell._head_yc.min + cell._head_yc.max) / 2.0; for(int k = 0; k < _nb_body_cells; k++) { - cell._body_xc.min = (_body_cells[k]._body_xc.min * r) + x; - cell._body_xc.max = (_body_cells[k]._body_xc.max * r) + x; - cell._body_yc.min = (_body_cells[k]._body_yc.min * r) + y; - cell._body_yc.max = (_body_cells[k]._body_yc.max * r) + y; + cell._belly_xc.min = (_body_cells[k]._body_xc.min * r) + x; + cell._belly_xc.max = (_body_cells[k]._body_xc.max * r) + x; + cell._belly_yc.min = (_body_cells[k]._body_yc.min * r) + y; + cell._belly_yc.max = (_body_cells[k]._body_yc.max * r) + y; cell_set->add_cell(&cell); } }