Question about image transformation for CPPEvalClient.cpp
Hi there,
I'm curently playing with C++ wrapper provided along with sources. What I want to do is to use trained networks within my Matlab scripts so I've created a small mex interface which takes an image as input and return a vector of scores for the image. I'm currently trying this approach on CIFAR-10.
From what I understood from CPPEvalClient.cpp, I have to take care about transforming image given from Matlab to a vector. What I did for MNIST was something like what can be found in attached file in
std::vector<float> imageToVector(double *, mwSize, mwSize, mwSize); function. It worked perfectly for grayscale images with 1 channel - I got the same outputs as were given by WRITE command. However, I was unable to workout the way how to properly transform 3-channel image to a vector. The way I tried to do it is described in the same function.
Am I doing something fundamentally wrong?
Thanks in advance
Source: CPPEvalClient.cpp.txt
Config: 01_Conv.cntk.txt 01_Convolution.ndl.txt
Model(remove txt extension): 01_Convolution.txt
Hi guys,
I was able to resolve the issue. Please, see attached file that allows to run any trained network on both 1-and 3 channel images.
Basically, the main trick was that image has to be given in BGR format, which I didn't know
Thanks
Hi Konstantin, Sorry about that - BGR format is an OpenCV legacy which our users (and, frankly, ourselves) often stumble on. While this fact is documented in the source code of ImageReader, there is no mention of it in our Wiki. I'm going to fix it.
Hi Alexey,
thanks for the confirmation. Also, if I see that some essential aspects are not covered in the wiki, do I create an issue for that? Or how do I notify you about this kind of problems? I know it is an offtopic, but still...
Thanks, Konstantin
Hello Konstantin!
Also, if I see that some essential aspects are not covered in the wiki, do I create an issue for that?
Great idea! Please, go ahead and create an issue - your help is very much appreciated by the whole team.
Thank you, Alexey
@sofeikov : For images that still need to be transformed into the right size, you may also want to have a look at this StackOverflow question
@ant0nsc to be honest that was the thread that sent me to the right direction :) I've put an upvote there :) Thanks again!
@sofeikov : Great to hear :-) Is the issue closed now?
@ant0nsc yes, the issue is closed. Thanks