-
Notifications
You must be signed in to change notification settings - Fork 312
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
loading data into InferenceModel #12
Comments
I'm afraid I'm no expert on OpenCV but I think CV_32FC is NHWC, i.e. in memory the data for an RGB image is RGB,RGB,RGB,etc.., Caffe convolution needs NCHW, in the Caffe documentation this is described as "n * c_i * h_i * w_i" here: http://caffe.berkeleyvision.org/tutorial/layers/convolution.html. I.e. it's a plane of all the R, followed by all the G, then all the B. So before passing the image data to your model, as well as converting the pixels to 32-bit floating point, you also have to rearrange it into NCHW layout. For ExecuteNetwork this is done in InferenceTestImage.cpp. Hope that helps, Matthew |
Hi @MatthewARM ,
The following are the results for using both the models with a) standard Caffe c++ library and b) armnnCaffeParser with the same input image a) standard Caffe c++
b) armnnCaffeParser
So actually it seems that caffe library and armnn work in the same way but there is still something related to the model. If needed I can provide both the models |
I'm pretty sure the problem must still be in the processing of the input data. Are you able to run your model through ExecuteNetwork? |
Hi @MatthewARM ,
Sorry I've just see that my last msg was wrong. This is the right situation for the results: a) standard Caffe c++
b) armnnCaffeParser
As you can see for model2 Caffe c++ and Armnn give the same wrong results |
If you are getting the same results from Caffe and Armnn, then the problem must be in the input data. Presumably the old 'data' layer was doing some stuff automatically that is not done by the new 'input' layer. |
Ok @MatthewARM , Nevertheless I think that more documentation and example data have to be provided on Armnn repository, since at the moment it is not easy to understand how to correctly use the library |
Hi @liviolima80, I agree and we're working on new documentation just as much as we're working on new functionality and performance. On the subject of examples, in this case the ArmNN runtime is performing as intended as a drop-in replacement for the Caffe runtime, so you should be able to follow a Caffe example. There is also code at https://github.com/ARM-software/ML-examples which has an example use of ArmNN in an MNIST application. |
HI @liviolima80 I'm closing this issue as it seems the original problem (data layout) has been resolved. if you figure out what the remaining problem is then please do let us know. |
Dear all,
I tried to modify InferenceModel in order to run a CNN network on single image. The problem is that if I compare the output of the network with the same model using Caffe library I get different output. I guess that the problem could be related to how the image data are loaded into input vector for the net.
This is how i done, starting from OpenCV image:
Can anyone give me some feedback about this or explain me how the image data has to be organized into input_vector?
Regards
The text was updated successfully, but these errors were encountered: