-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为什么mobilefacenet提取的任意图片的特征向量都是一样的,下面是我的主程序 #5
Comments
你读读ncnn的源码net.cpp就知道extractor是不能重用的,它直接返回上次的结果。 |
mobilefacenet.param里面已经做了substract_mean_normalize,应该不用再归一化一次吧 |
您好,很感谢你能提供这么方便的工具,代码中我只改了路径,转换后测试结果全为0.9999,请问您知道这是什么原因吗 |
@af258963 不用归一化了,thank |
改了哪一部分的路径,代码可以贴出来 review一下 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
#include <stdio.h>
#include
#include
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include
//using namespace std;
using namespace cv;
#include "net.h"
static int detect_squeezenet(const cv::Mat& bgr, std::vector& cls_scores)
{
ncnn::Net squeezenet;
squeezenet.load_param("/home1/syy/DownLoad/ncnn-mtcnn/ncnn-master/mobilefacenet/mobilefacenet.param");
squeezenet.load_model("/home1/syy/DownLoad/ncnn-mtcnn/ncnn-master/mobilefacenet/mobilefacenet.bin");
}
double calculSimilar(std::vector& v1, std::vector& v2)
{
assert(v1.size() == v2.size());
double ret = 0.0, mod1 = 0.0, mod2 = 0.0;
for (std::vector::size_type i = 0; i != v1.size(); ++i)
{
ret += v1[i] * v2[i];
mod1 += v1[i] * v1[i];
mod2 += v2[i] * v2[i];
}
return (ret / sqrt(mod1) / sqrt(mod2) + 1) / 2.0;
//std::cout<<ret<<" "<<mod1<<" "<<mod2<<std::endl;
//return ret / sqrt(mod1) / sqrt(mod2);
}
int main(int argc, char** argv)
{
cv::Mat img1 = cv::imread("/home1/syy/DownLoad/ncnn-mtcnn/ncnn-master/mobilefacenet/1.jpg", CV_LOAD_IMAGE_COLOR);
}
The text was updated successfully, but these errors were encountered: