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

Enhanced 'build_apk.py' logic & 'README.md' #41

Merged
merged 3 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions apps/android/ImageClassification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

1. Java, android-sdk and sdkmanager is already set at user's end
2. User should have Linux QNN SDK in local machine.
3. If models need to be downloaded during the execution of build_apk.py, qai-hub must be installed first according to the[ README.md in ai-hub-models](https://github.com/quic/ai-hub-models/blob/main/README.md).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you replace qui-hub with AI Hub Models

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your correction. The document has been revised

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you also move the space before README.md outside of the link text. Thanks!

Copy link
Contributor Author

@fangxingSR fangxingSR May 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was my negligence, thank you for pointing out the mistake. The document has been revised


4. When downloading [MobileNet_v3_Small](https://aihub.qualcomm.com/mobile/models/mobilenet_v3_small) via the web interface, qai-hub installation can be temporarily skipped.



## Info
Expand Down Expand Up @@ -53,20 +57,33 @@ Right now we use mobilenet_v3_small.tflite model which takes 224x224 as input an

You have to run build_apk.py for Image Classification. It will generate classification-debug.apk and install it in connected device.

Please first use `python build_apk.py -h` to understand the parameters.


```
build_apk.py [-h] -q QNNSDK [-m MODEL_NAME] [-path MODEL_PATH]
```

build_apk.py [-h] -q QNNSDK (-m MODEL_PATH | -e MODEL_NAME)
The parameter "-q" must be entered. QNN SDK can be utilized by setting an environment variable or specifying the path directly.<br />There are three ways to input parameters:<br />1. Inputting only the parameter "-path"<br />2. Inputting only the parameter "-m"<br />3. Neither entering the parameter "-m" nor "-path"



### Example

Here, with -m, give your tflite model path i.e. till `*.tflite file`, and it will copy model file to assets folder to build andoid app.
Here, with -path, give your tflite model path i.e. till `*.tflite file`, and it will copy model file to assets folder to build andoid app.
```
python build_apk.py -q "<QNN_SDK_PATH>" -m "Path\to\TFLITE\Model"
python build_apk.py -q "<QNN_SDK_PATH>" -path "Path/to/TFLITE/Model"
```


Also, you can use AI-HUB Model name as mentioned in models directory, to directly export the model from AI-Hub and copy it to app assets.

```
python build_apk.py -q "<QNN_SDK_PATH>" -e <Model Name>
python build_apk.py -q "<QNN_SDK_PATH>" -m <Model Name>
```

You can also select the model provided in the list menu during the execution of build_apk.py without specifying the model name and model path.

```
python build_apk.py -q "<QNN_SDK_PATH>"
```
2 changes: 1 addition & 1 deletion apps/android/ImageClassification/build_apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def printmenu():


##based on this pre-post can be decided
if not args.model_name:
if not args.model_name and not args.model_path:
printmenu()
inp_model_name = int(input("Please select one: "))
args.model_name = MODELNAME(inp_model_name).name
Expand Down