The problem occurs when I have to put inside my own init.pb and predict.pb files from different model. My model is densnet.
The error is:
[F given_tensor_fill_op.h:27] Check failed: output->size() == values_.size() output size: 159744 given size: 75129
Does anyone has accomplished to work the AI Camera Caffe2 project or any other pytorch/caffe2 project with different model in ANDROID??
Is this caffe2 inside the specific android project only works with squeezenet?
@smth thank you for taking the time to help with my problem these days before Christmas.
I will try your solution this afternoon and I will notify you again about the results.
A lot of people from Udacity/Facebook scholarship challenge that is currently running are interested in this!!
@smth
I tried to use latest NDK 18.
Unfortunately it gives the below error:
““Build command failed.
Error while executing process C:\Users\farmaker1\AppData\Local\Android\Sdk\cmake\3.6.4111459\bin\cmake.exe with arguments {–build C:\Users\farmaker1\Desktop\Sumith\app.externalNativeBuild\cmake\debug\armeabi-v7a --target native-lib}
ninja: error: ‘…/…/…/…/src/main/jniLibs/armeabi-v7a/libcaffe2.a’, needed by ‘…/…/…/…/build/intermediates/cmake/debug/obj/armeabi-v7a/libnative-lib.so’, missing and no known rule to make it””
This error did not occur with NDK 17. and different CMakelists file (Which project I have managed to run it in mobile…BUT only works with Squeezenet init and predict files which was my main concern)
I would be glad if you gave me your thoughts about that.
I won’t debug doing stuff on Windows (sorry), but from what I can see, the Android app build cannot find libcaffe2.a: You’re supposed to get a libcaffe2.a for armeabi-v7a (and for x86) from building caffe for Android from PyTorch master (twice) and then copy it to the respective directory.
@tom Thank you for taking time to answer my question. As Pytorch is getting more users these questions will become more and more frequent. A last question. Do you know if this AICamera example is for Squeezenet only or we can use our Densnet files?
Happy holidays!
Hi, I’ve been working with the AICamera example for PyTorch with MobileNet V2. As Ji Lin’s MobileNet V2 implementation includes a dropout layer, I wasn’t able to export the model to Android in the stable PyTorch 1.0 release (execution with predictor failed in both Python and Android). So, I had to remove that layer. Also, I couldn’t export the pretrained SqueezeNet model from PyTorch as it uses ceil_mode=True and ONNX export failed with that.
This week I cloned the PyTorch master from GitHub, as I saw those issues were fixed. I built the library and installed it, then I was able to export the models and execute them with predictor in Python. Then I also built the Caffe 2 API for Android using the build_android.sh script from the repo and copied the files to the AICamera project. I then copied the MobileNet V2 with dropout init_net and predict_net to the Android project and it worked perfectly. Nevertheless, when I tried to use the pretrained SqueezeNet model that I had exported, the Android app crashed in the model execution with predictor (even though it executed without trouble in Python).
I want to know how to fix it as I’ve seen SqueezeNet has been used with AICamera.
Some details that might help:
In stable PyTorch, the ONNX exported graph included the dropout and that was the reason why it couldn’t be executed with predictor. Now the dropout is not in the graph and I think that’s why it is executed correctly in both Python and PyTorch. What I mean is that it might have nothing to do with me building/updating the Caffe 2 API for Android.
I tried with both the original SqueezeNet pretrained model and a transfer-learning-trained one but none of them worked (it must be something in the architecture).