Skip to content
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

Open
alejo9719 opened this issue Apr 12, 2019 · 0 comments
Open
Labels
question Further information is requested

Comments

@alejo9719
Copy link

alejo9719 commented Apr 12, 2019

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.

@cedrickchee cedrickchee added the question Further information is requested label May 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants