Skip to content

Commit 71e7e3e

Browse files
authored
Add files via upload
1 parent 78f4fe7 commit 71e7e3e

File tree

14 files changed

+368
-0
lines changed

14 files changed

+368
-0
lines changed

Instructions.ipynb

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Running Tensorflow Models on Android\n",
8+
"\n",
9+
"### What is this?\n",
10+
"\n",
11+
"This is a handwritten character image (MNIST) classifier that can run on any android device. The app stores a set of images (0-9) that we can cycle through and classify in order. It uses a pre-trained model to perform inference on the device. This idea can be applied to any images, both by using the camera and by pulling from the Web. We're using preloaded images so we can run the app in a simulator (no need for the device since it doesn't require a camera).\n",
12+
"\n",
13+
"![alt text](https://jalammar.github.io/images/android-tensorflow-app-structure_2.png \"Logo Title Text 1\")\n",
14+
"\n",
15+
"### Video Demo\n",
16+
"\n",
17+
"https://www.youtube.com/watch?v=gahi0Hjgokw\n",
18+
"\n",
19+
"### Other examples of Tensorflow on Android \n",
20+
"\n",
21+
"1. Image classifier https://github.com/MindorksOpenSource/AndroidTensorFlowMachineLearningExample Really well documented\n",
22+
"2. Another classifier https://github.com/alseambusher/Paideia combined with Wikipedia APi to list detailed information about the object\n",
23+
"3. Guess a sketch https://github.com/nuaimat/GuessSketch \n",
24+
"\n",
25+
"### Installation Steps\n",
26+
"\n",
27+
"If you already have Android Studio, skip to Step 5!\n",
28+
"\n",
29+
"#### Step 1 Download Android studio\n",
30+
"\n",
31+
"https://developer.android.com/studio/index.html\n",
32+
"\n",
33+
"#### Step 2 Download Android SDK\n",
34+
"\n",
35+
"`$ wget https://dl.google.com/android/android-sdk_r24.4.1-linux.tgz\n",
36+
"$ tar xvzf android-sdk_r24.4.1-linux.tgz -C ~/tensorflow`\n",
37+
"\n",
38+
"#### Step 3 Download SDK Build Tools\n",
39+
"\n",
40+
"`$ cd ~/tensorflow/android-sdk-linux\n",
41+
"$ tools/android update sdk --no-ui`\n",
42+
"\n",
43+
"#### Step 4 Download Android NDK\n",
44+
"\n",
45+
"`$ wget https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip\n",
46+
"$ unzip android-ndk-r12b-linux-x86_64.zip -d ~/tensorflow`\n",
47+
"\n",
48+
"Set correct SDK and NDK versions in your workspace file\n",
49+
"\n",
50+
"#### Step 5 Train Model in Python on your desktop or a server \n",
51+
"\n",
52+
"2 included options \n",
53+
"\n",
54+
"`tensorflow_model/mnist_convnet_keras.py\n",
55+
"tensorflow_model/mnist_convnet.py `\n",
56+
"\n",
57+
"#### Step 6 Download the latest Tensorflow Android release package (AAR)\n",
58+
"\n",
59+
"AAR (Android Archive) files are a convenient way to distribute packages– mainly libraries– for use with Android Studio and Gradle. Adding one of these files to your app requires creating some metadata files and updating your app’s gradle build files. Fortunately, Android Studio can handle all of this for us.\n",
60+
"\n",
61+
"http://docs.onemobilesdk.aol.com/android-ad-sdk/adding-aar-files.html\n",
62+
"\n",
63+
"### Step 7 Compile the code and run it on a simulator (or device if you have one)! \n"
64+
]
65+
},
66+
{
67+
"cell_type": "markdown",
68+
"metadata": {
69+
"collapsed": true
70+
},
71+
"source": [
72+
"# Steps in this tutorial\n",
73+
"\n",
74+
"1. Overview of the Python file for training a CNN (how is the model saved?)\n",
75+
"2. Overview of MainActivity, drawModel, drawRenderer, drawView (draw specific code)\n",
76+
"3. Overview of TensorflowClassification, Classifier, Classification (ML code)\n",
77+
"\n",
78+
"\n"
79+
]
80+
},
81+
{
82+
"cell_type": "code",
83+
"execution_count": null,
84+
"metadata": {
85+
"collapsed": true
86+
},
87+
"outputs": [],
88+
"source": []
89+
}
90+
],
91+
"metadata": {
92+
"kernelspec": {
93+
"display_name": "Python 3",
94+
"language": "python",
95+
"name": "python3"
96+
},
97+
"language_info": {
98+
"codemirror_mode": {
99+
"name": "ipython",
100+
"version": 3
101+
},
102+
"file_extension": ".py",
103+
"mimetype": "text/x-python",
104+
"name": "python",
105+
"nbconvert_exporter": "python",
106+
"pygments_lexer": "ipython3",
107+
"version": "3.6.0"
108+
}
109+
},
110+
"nbformat": 4,
111+
"nbformat_minor": 2
112+
}

images/Screenshots/0.png

22.1 KB
Loading

images/Screenshots/1.png

20.5 KB
Loading

images/Screenshots/2.png

20.4 KB
Loading

images/Screenshots/3.png

20.6 KB
Loading

images/Screenshots/4.png

19.4 KB
Loading

images/Screenshots/5.png

21.6 KB
Loading

images/Screenshots/6.png

20.7 KB
Loading

images/Screenshots/7.png

20.4 KB
Loading

images/Screenshots/8.png

21.5 KB
Loading

0 commit comments

Comments
 (0)