提交 4f9cc81a 编写于 作者: L liuruilong

fix issue #666 result error

上级 5e8d06d5
...@@ -58,7 +58,9 @@ void PoolCompute(const PoolParam &param) { ...@@ -58,7 +58,9 @@ void PoolCompute(const PoolParam &param) {
paddings[i] = 0; paddings[i] = 0;
ksize[i] = static_cast<int>(in_x->dims()[i + 2]); ksize[i] = static_cast<int>(in_x->dims()[i + 2]);
} }
} else if (ksize[0] == 3 && ksize[0] == ksize[1]) { }
if (ksize[0] == 3 && ksize[0] == ksize[1]) {
if (pooling_type == "max") { if (pooling_type == "max") {
if (strides[0] == strides[1] && strides[0] == 1 && if (strides[0] == strides[1] && strides[0] == 1 &&
paddings[0] == paddings[1] && paddings[1] == 1) { paddings[0] == paddings[1] && paddings[1] == 1) {
......
...@@ -20,7 +20,11 @@ int main() { ...@@ -20,7 +20,11 @@ int main() {
paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile; paddle_mobile::PaddleMobile<paddle_mobile::CPU> paddle_mobile;
paddle_mobile.SetThreadNum(4); paddle_mobile.SetThreadNum(4);
auto time1 = time(); auto time1 = time();
if (paddle_mobile.Load(g_mobilenet, true)) { // auto isok = paddle_mobile.Load(std::string(g_mobilenet_detect) + "/model",
// std::string(g_mobilenet_detect) + "/params", true);
auto isok = paddle_mobile.Load(g_mobilenet, true);
if (isok) {
auto time2 = time(); auto time2 = time();
std::cout << "load cost :" << time_diff(time1, time1) << "ms" << std::endl; std::cout << "load cost :" << time_diff(time1, time1) << "ms" << std::endl;
...@@ -39,13 +43,14 @@ int main() { ...@@ -39,13 +43,14 @@ int main() {
for (int i = 0; i < 10; ++i) { for (int i = 0; i < 10; ++i) {
auto vec_result = paddle_mobile.Predict(input, dims); auto vec_result = paddle_mobile.Predict(input, dims);
} }
DLOG << vec_result;
auto time4 = time(); auto time4 = time();
std::cout << "predict cost :" << time_diff(time3, time4) / 10 << "ms" std::cout << "predict cost :" << time_diff(time3, time4) / 10 << "ms"
<< std::endl; << std::endl;
} }
std::cout std::cout << "如果结果Nan请查看: test/images/g_test_image_1x3x224x224_banana "
<< "如果结果Nan请查看: test/images/test_image_1x3x224x224_float 是否存在?" "是否存在?"
<< std::endl; << std::endl;
return 0; return 0;
} }
...@@ -28,6 +28,7 @@ static const char *g_ocr = "../models/ocr"; ...@@ -28,6 +28,7 @@ static const char *g_ocr = "../models/ocr";
static const char *g_mobilenet_ssd = "../models/mobilenet+ssd"; static const char *g_mobilenet_ssd = "../models/mobilenet+ssd";
static const char *g_mobilenet_ssd_gesture = "../models/mobilenet+ssd_gesture"; static const char *g_mobilenet_ssd_gesture = "../models/mobilenet+ssd_gesture";
static const char *g_mobilenet_combined = "../models/mobilenet_combine"; static const char *g_mobilenet_combined = "../models/mobilenet_combine";
static const char *g_mobilenet_detect = "../models/mobilenet-detect";
static const char *g_squeezenet = "../models/squeezenet"; static const char *g_squeezenet = "../models/squeezenet";
static const char *g_googlenet = "../models/googlenet"; static const char *g_googlenet = "../models/googlenet";
static const char *g_mobilenet = "../models/mobilenet"; static const char *g_mobilenet = "../models/mobilenet";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册