happynear / happynear/FaceVerification

改写VerificationDemo.m为C语言版本后,distance为零

Open
#59 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
MATLAB
Stars
447
Forks
230
PR merge metrics
No merged PRs in 30d

Description

博士,您好,非常感谢您的共享,还有点困惑麻烦您解疑。
我在matlab下,利用CASIA_demo.prototxt、CASIA_iter_666000.caffemodel以及mean.proto能够正常运行VerificationDemo.m,得出两幅人脸图像的距离值。但是我改写成C语言版本后,也是运用以上三个文件,为什么每次得出的距离值都是0?
改写的C版本关键代码如下,麻烦您指导下
LOG(INFO) << "reading model from " << FLAGS_model;
Net caffe_test_net(FLAGS_model, TEST);
LOG(INFO) << "reading weights from " << FLAGS_weights;
caffe_test_net.CopyTrainedLayersFrom(FLAGS_weights);
----------------------------------------------------------------------
人脸检测与对齐,以及去均值,人脸图像(100,100)
----------------------------------------------------------------------
std::vector datum_vector;
datum_vector.push_back(face1);
datum_vector.push_back(face2);

std::vector labels;
labels.push_back(1);
labels.push_back(2);

MemoryDataLayer* data_layer_ptr = (MemoryDataLayer*)&(*caffe_test_net.layers()[0]);
data_layer_ptr->AddMatVector(datum_vector,labels);
const std::vector*>& result = caffe_test_net.ForwardPrefilled();
cout<<"distance:" << result[0]->cpu_data()[0]<cpu_data()[0]都是0,谢谢!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.