How to use mean.binaryproto with blobFromImage(s) ?
I’m using dnn::readNetFromCaffe
to load this model published in the caffe model zoo:
https://github.com/BVLC/caffe/wiki/Mo...
Apart from the standard .prototxt
and .caffemodel
files, a third file is provided: mean.binaryproto
.
I know I should use it to perform the mean subtraction. But I couldn't figure out whether its a cv::subtract
I should apply before invoking blobFromImage
or is it something I'd use to somehow infer the mean
and scalefactor
parameters.
Mat mean = readMeanFromBinary(); // How to read a binaryproto into a Mat ?
Mat img = imread(imgFile);
// How to use mean ?
Mat inputBlob = blobFromImage(img, 1.0f, Size(227, 227), Scalar(), false);
net.setInput(inputBlob, "data");
Mat prob = age.forward("prob");
So I have basically two questions:
- How to read the
mean.binaryproto
file into aMat
? - Once I have the mean, can I use it with
blobFromImage
?
thanks Fábio
can you take a look here ?
I know this question is old but now I am in the same situation: I want to load the files without having to install Caffe. Is it possible? Have you found a solution?
@Francesco Boi :
my current solution is to install caffe on google's colab via
!apt install -y caffe-cuda
, and run the python script below ;)