-
Notifications
You must be signed in to change notification settings - Fork 232
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
改写VerificationDemo.m为C语言版本后,distance为零 #59
Comments
这个得debug一下,比如说把中间层输出出来看一下。 这个代码已经很老了,我建议你用caffe.binding.dll来调用caffe,那个接口比较清晰。 https://github.com/happynear/caffe-windows/tree/ms/windows/caffe.binding |
谢谢您的回复。使用了caffe.binding, |
你可以debug一下,依次用GetBlobData来获取中间层的输出来看看是不是0. |
conv52层输出为0,之前中间层输出为非0数值 |
那就得再确认一下log里有没有把conv52层的weight读进来了。 |
好的,谢谢,我再试试。 |
@shandqc 你好,我在matlab下,利用CASIA_demo.prototxt、CASIA_iter_666000.caffemodel以及mean.proto运行VerificationDemo.m的结果是matlab停止工作,提示appcrash,请问你是如何运行成功的呢? |
博士,您好,非常感谢您的共享,还有点困惑麻烦您解疑。
我在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);
MemoryDataLayer* data_layer_ptr = (MemoryDataLayer*)&(caffe_test_net.layers()[0]);
data_layer_ptr->AddMatVector(datum_vector,labels);
const std::vector<Blob>& result = caffe_test_net.ForwardPrefilled();
cout<<"distance:" << result[0]->cpu_data()[0]<<endl;
为什么每次 result[0]->cpu_data()[0]都是0,谢谢!
The text was updated successfully, but these errors were encountered: