Skip to content
This repository has been archived by the owner on Oct 16, 2019. It is now read-only.

Help please #1

Open
heon01px2020 opened this issue Jan 4, 2019 · 7 comments
Open

Help please #1

heon01px2020 opened this issue Jan 4, 2019 · 7 comments
Labels
question Further information is requested

Comments

@heon01px2020
Copy link

heon01px2020 commented Jan 4, 2019

In this project, it seems to be using resnet or squeezenet. However, in a project I'm doing of my own, I am currently using mobilenetv2. Currently, I have converted the mobilenetv2 model from pytorch to caffe2. If I use this caffe2 file, would it work seamlessly after replacing the _init_net.pb and _predict_net.pb or do I need to make other modifications? Thank you.

@cedrickchee
Copy link
Owner

would it work seamlessly after replacing the _init_net.pb and _predict_net.pb or do I need to make other modifications?

It should. MobileNet v2 (or SqueezeNet) input (data)/output (prediction) tensor dimension is the same. So, it work seamlessly (no code changes required to the native-lib.cpp).

Unfortunately, when I tested with a quantized MobileNet v2 today, the Android app crashed due to Caffe2 quantized fc op:

mobilenet_v2_caffe2_predictnet_crash

2019-01-04 16:27:24.093 32484-32545/facebook.f8demo A/native: [F int8_fc_op.h:43] Check failed: K == W.t.size(1) 
2019-01-04 16:27:24.093 32484-32545/facebook.f8demo A/native: terminating.
    
    
    --------- beginning of crash
2019-01-04 16:27:24.093 32484-32545/facebook.f8demo A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 32545 (Camera Backgrou), pid 32484 (facebook.f8demo)

I have not tested with non-quantized MobileNet v2 yet.

@cedrickchee cedrickchee added the question Further information is requested label Jan 4, 2019
@heon01px2020
Copy link
Author

heon01px2020 commented Jan 4, 2019

Ok, thank you so much! I had another question which was that I have an image classification model, not an object detection model. Would there be any modifications needed?

@cedrickchee
Copy link
Owner

Unless I understand it incorrectly, isn't MobileNet/ResNet18 a classification model?

@heon01px2020
Copy link
Author

Yes, the Mobilenet v2 model I made is a classification model. I thought that your tutorial used object detection. Does that require me to make any modifications to the code? What I want to do is have the app take frames from the video, classify the image, and output the classification on the screen. Thank you!

@cedrickchee
Copy link
Owner

cedrickchee commented Jan 7, 2019

My tutorials used image classification models. It should not require any modifications to the code if you put aside and do not count my previous reply where the MobileNet v2 is experiencing error. I can't confirm at this point if this problem is due to Caffe2 or my own code, but from the error messages, I can tell that the problem is in Caffe2 or ONNX exporter.

What I want to do is have the app take frames from the video, classify the image, and output the classification on the screen.

The Android app is doing exactly that. Try it and find out yourself! 🙂

@heon01px2020
Copy link
Author

Ok, thank you! I tried again without my model, but it couldn't build because I am missing jniLibs.armeabi-v7a/libcaffe2.a Do you know how to get it?

@cedrickchee
Copy link
Owner

The steps to download libcaffe2.a and other library files are in the README.

If you prefer not to build PyTorch from master, I have committed the files for the Caffe2 bits into this git repo. Unfortunately, not all files are uploaded to GitHub due to file size limit.
Grab the remaining large files from my [Google Drive](https://drive.google.com/drive/folders/1e1lFa8W2rkA8M7mhahe9VSiSMnl0a4Ab?usp=sharing.

I don't know how you missed it. May be I should have been clearer.

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