This repository has been archived by the owner on Oct 16, 2019. It is now read-only.
Issues with SqueezeNet in the app (PyTorch master as of 09/04/2019) #6
Labels
question
Further information is requested
Hi, I’ve been working with this AICamera example for PyTorch using Ji Lin's MobileNet V2 implementation. As Ji Lin’s 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 the SqueezeNet implementation from https://github.com/onnx/tutorials/blob/master/tutorials/PytorchCaffe2MobileSqueezeNet.ipynb which has ceil_mode=False and the execution in Android also fails.
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).
I tried with the SqueezeNet init_net.pb and predict_net.pb included in https://github.com/cedrickchee/pytorch-android (this repo) and it DID work in Android.
Thanks.
The text was updated successfully, but these errors were encountered: