freesouls / face-alignment-at-3000fps

The project is an C++ implementation of Face Alignment at 3000fps via Regressing Local Binary Features
283 stars 145 forks source link

mean shape的偏移 #1

Closed NanYoMy closed 9 years ago

NanYoMy commented 9 years ago

我训练完模型后,发现利用opencv人脸检测后的box,都成产生了向-y轴偏移,你在训练中有没有碰到过这个问题

freesouls commented 9 years ago

如果你在utils.cpp的LoadImage中没有删掉下面几句话是有可能的,因为image在resize的时候除以3后是取整,而shape除以3.0是浮点,可能resize过的ground_truth与图已经有偏移了,我猜测这里有问题。要不你去掉下面的话,要不自己重新resize使它不会有偏移~ if (image.cols > 2000){ cv::resize(image, image, cv::Size(image.rows / 3, image.cols / 3), 0, 0, cv::INTER_LINEAR); ground_truth_shape /= 3.0; } else if (image.cols > 1400 && image.cols <= 2000){ cv::resize(image, image, cv::Size(image.rows / 2, image.cols / 2), 0, 0, cv::INTER_LINEAR); ground_truth_shape /= 2.0; }

NanYoMy commented 9 years ago

fork了其他的代码,谢谢回答啊。

freesouls commented 9 years ago

将cv::resize(image, image, cv::Size(image.rows / 3, image.cols / 3), 0, 0, cv::INTER_LINEAR); 改成cv::resize(image, image, cv::Size(image.cols / 3, image.rows / 3), 0, 0, cv::INTER_LINEAR);就好了 @NanYoMy