From 08e261f42301b8f326bd6db28a35e84e0212142f Mon Sep 17 00:00:00 2001 From: nihui Date: Thu, 18 Jan 2018 23:10:30 +0800 Subject: [PATCH] innerproduct produce continous blob, fix #236 --- examples/fasterrcnn.cpp | 16 ++++----- examples/squeezencnn/jni/squeezencnn_jni.cpp | 2 +- src/layer/arm/innerproduct_arm.cpp | 36 ++------------------ src/layer/innerproduct.cpp | 5 ++- src/layer/scale.cpp | 4 +-- 5 files changed, 13 insertions(+), 50 deletions(-) diff --git a/examples/fasterrcnn.cpp b/examples/fasterrcnn.cpp index c3091f20e..6b82de8a5 100644 --- a/examples/fasterrcnn.cpp +++ b/examples/fasterrcnn.cpp @@ -174,7 +174,7 @@ static int detect_fasterrcnn(const cv::Mat& bgr, std::vector& objects) ex2.extract("bbox_pred", bbox_pred); ex2.extract("cls_prob", cls_prob); - int num_class = cls_prob.c; + int num_class = cls_prob.w; class_candidates.resize(num_class); // find class id with highest score @@ -182,7 +182,7 @@ static int detect_fasterrcnn(const cv::Mat& bgr, std::vector& objects) float score = 0.f; for (int i=0; i score) { label = i; @@ -206,14 +206,10 @@ static int detect_fasterrcnn(const cv::Mat& bgr, std::vector& objects) float pb_h = y2 - y1 + 1; // apply bbox regression - const float* bbox_xptr = bbox_pred.channel(label * 4); - const float* bbox_yptr = bbox_pred.channel(label * 4 + 1); - const float* bbox_wptr = bbox_pred.channel(label * 4 + 2); - const float* bbox_hptr = bbox_pred.channel(label * 4 + 3); - float dx = bbox_xptr[0]; - float dy = bbox_yptr[0]; - float dw = bbox_wptr[0]; - float dh = bbox_hptr[0]; + float dx = bbox_pred[label * 4]; + float dy = bbox_pred[label * 4 + 1]; + float dw = bbox_pred[label * 4 + 2]; + float dh = bbox_pred[label * 4 + 3]; float cx = x1 + pb_w * 0.5f; float cy = y1 + pb_h * 0.5f; diff --git a/examples/squeezencnn/jni/squeezencnn_jni.cpp b/examples/squeezencnn/jni/squeezencnn_jni.cpp index 036f14358..7ff436b5a 100644 --- a/examples/squeezencnn/jni/squeezencnn_jni.cpp +++ b/examples/squeezencnn/jni/squeezencnn_jni.cpp @@ -146,7 +146,7 @@ JNIEXPORT jstring JNICALL Java_com_tencent_squeezencnn_SqueezeNcnn_Detect(JNIEnv cls_scores.resize(out.c); for (int j=0; j& bottom_top_blobs) const { float* ptr = bottom_top_blob.channel(q); - float s = scale_blob.channel(q)[0]; + float s = scale_blob[q]; float bias = bias_data[q]; for (int i=0; i& bottom_top_blobs) const { float* ptr = bottom_top_blob.channel(q); - float s = scale_blob.channel(q)[0]; + float s = scale_blob[q]; for (int i=0; i