Skip to content

Commit 36ca54d

Browse files
committed
add Spc detector
1 parent b0a9375 commit 36ca54d

File tree

82 files changed

+13288
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+13288
-1
lines changed

AndroidManifest.xml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
3+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
4+
package="com.irina.tensorflowexample">
5+
6+
<uses-permission android:name="android.permission.CAMERA" />
7+
<uses-feature android:name="android.hardware.camera" />
8+
<uses-feature android:name="android.hardware.camera.autofocus" />
9+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
10+
<uses-permission android:name="android.permission.RECORD_AUDIO" />
11+
12+
<application
13+
android:allowBackup="true"
14+
android:icon="@mipmap/ic_launcher"
15+
android:label="@string/app_name"
16+
android:supportsRtl="true"
17+
android:largeHeap="true"
18+
android:theme="@style/AppTheme">
19+
<activity android:name="com.irina.tensorflowexample.CameraActivity">
20+
<intent-filter>
21+
<action android:name="android.intent.action.MAIN" />
22+
23+
<category android:name="android.intent.category.LAUNCHER" />
24+
</intent-filter>
25+
</activity>
26+
</application>
27+
28+
</manifest>

TensorflowDetection

Lines changed: 0 additions & 1 deletion
This file was deleted.

assets/coco_labels_list.txt

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
???
2+
person
3+
bicycle
4+
car
5+
motorcycle
6+
airplane
7+
bus
8+
train
9+
truck
10+
boat
11+
traffic light
12+
fire hydrant
13+
???
14+
stop sign
15+
parking meter
16+
bench
17+
bird
18+
cat
19+
dog
20+
horse
21+
sheep
22+
cow
23+
elephant
24+
bear
25+
zebra
26+
giraffe
27+
???
28+
backpack
29+
umbrella
30+
???
31+
???
32+
handbag
33+
tie
34+
suitcase
35+
frisbee
36+
skis
37+
snowboard
38+
sports ball
39+
kite
40+
baseball bat
41+
baseball glove
42+
skateboard
43+
surfboard
44+
tennis racket
45+
bottle
46+
???
47+
wine glass
48+
cup
49+
fork
50+
knife
51+
spoon
52+
bowl
53+
banana
54+
apple
55+
sandwich
56+
orange
57+
broccoli
58+
carrot
59+
hot dog
60+
pizza
61+
donut
62+
cake
63+
chair
64+
couch
65+
potted plant
66+
bed
67+
???
68+
dining table
69+
???
70+
???
71+
toilet
72+
???
73+
tv
74+
laptop
75+
mouse
76+
remote
77+
keyboard
78+
cell phone
79+
microwave
80+
oven
81+
toaster
82+
sink
83+
refrigerator
84+
???
85+
book
86+
clock
87+
vase
88+
scissors
89+
teddy bear
90+
hair drier
91+
toothbrush

assets/spc_labels.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
???
2+
Sign
3+
Pedestrian
4+
Car
22 MB
Binary file not shown.
84.5 MB
Binary file not shown.
27.7 MB
Binary file not shown.

build.gradle

Lines changed: 189 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,189 @@
1+
2+
// Top-level build file where you can add configuration options common to all sub-projects/modules.
3+
4+
buildscript {
5+
repositories {
6+
jcenter()
7+
maven {
8+
url 'https://maven.google.com/'
9+
name 'Google'
10+
}
11+
}
12+
dependencies {
13+
classpath 'com.android.tools.build:gradle:3.0.0'
14+
15+
// NOTE: Do not place your application dependencies here; they belong
16+
// in the individual module build.gradle files
17+
}
18+
}
19+
20+
allprojects {
21+
repositories {
22+
jcenter()
23+
maven {
24+
url 'https://maven.google.com/'
25+
name 'Google'
26+
}
27+
}
28+
}
29+
30+
31+
32+
project.ext.ASSET_DIR = projectDir.toString() + '/assets'
33+
def bazelLocation = '/usr/local/bin/bazel'
34+
def nativeBuildSystem = 'cmake'
35+
36+
// Controls output directory in APK and CPU type for Bazel builds.
37+
// NOTE: Does not affect the Makefile build target API (yet), which currently
38+
// assumes armeabi-v7a. If building with make, changing this will require
39+
// editing the Makefile as well.
40+
// The CMake build has only been tested with armeabi-v7a; others may not work.
41+
//def cpuType = 'armeabi-v7a'
42+
def cpuType = 'arm64-v8a'
43+
//def cpuType = 'x86_64'
44+
45+
// Output directory in the local directory for packaging into the APK.
46+
def nativeOutDir = 'libs/' + cpuType
47+
48+
// Default to building with Bazel and override with make if requested.
49+
def nativeBuildRule = 'buildNativeBazel'
50+
def demoLibPath = '/home/irina/tensorflow/bazel-bin/tensorflow/examples/android/libtensorflow_demo.so'
51+
def inferenceLibPath = '/home/irina/tensorflow/bazel-bin/tensorflow/contrib/android/libtensorflow_inference.so'
52+
if (nativeBuildSystem == 'makefile') {
53+
nativeBuildRule = 'buildNativeMake'
54+
demoLibPath = '/home/irina/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow_demo.so'
55+
inferenceLibPath = '/home/irina/tensorflow/tensorflow/contrib/makefile/gen/lib/libtensorflow_inference.so'
56+
}
57+
58+
apply plugin: 'com.android.application'
59+
60+
android {
61+
compileSdkVersion 27
62+
buildToolsVersion "26.0.2"
63+
64+
if (nativeBuildSystem == 'cmake') {
65+
defaultConfig {
66+
applicationId = 'com.irina.tensorflowexample'
67+
versionCode 1
68+
versionName "1.0"
69+
minSdkVersion 21
70+
targetSdkVersion 27
71+
ndk {
72+
abiFilters "${cpuType}"
73+
}
74+
externalNativeBuild {
75+
cmake {
76+
arguments '-DANDROID_TOOLCHAIN=gcc', '-DANDROID_STL=gnustl_static'
77+
cppFlags "-std=c++11"
78+
}
79+
}
80+
}
81+
externalNativeBuild {
82+
cmake {
83+
path './jni/CMakeLists.txt'
84+
}
85+
}
86+
}
87+
buildTypes {
88+
release {
89+
minifyEnabled false
90+
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
91+
}
92+
}
93+
lintOptions {
94+
abortOnError false
95+
}
96+
97+
98+
compileOptions {
99+
sourceCompatibility JavaVersion.VERSION_1_8
100+
targetCompatibility JavaVersion.VERSION_1_8
101+
}
102+
103+
sourceSets {
104+
main {
105+
if (nativeBuildSystem == 'bazel' || nativeBuildSystem == 'makefile') {
106+
// TensorFlow Java API sources.
107+
java {
108+
srcDir '/home/irina/tensorflow/tensorflow/java/src/main/java'
109+
exclude '**/examples/**'
110+
}
111+
112+
// Android TensorFlow wrappers, etc.
113+
java {
114+
srcDir '/home/irina/tensorflow/tensorflow/contrib/android/java'
115+
}
116+
}
117+
// Android demo app sources.
118+
java {
119+
srcDir 'src'
120+
}
121+
122+
manifest.srcFile 'AndroidManifest.xml'
123+
resources.srcDirs = ['src']
124+
aidl.srcDirs = ['src']
125+
renderscript.srcDirs = ['src']
126+
res.srcDirs = ['res']
127+
assets.srcDirs = [project.ext.ASSET_DIR]
128+
jniLibs.srcDirs = ['libs','jni']
129+
}
130+
131+
debug.setRoot('build-types/debug')
132+
release.setRoot('build-types/release')
133+
}
134+
}
135+
136+
task buildNativeBazel(type: Exec) {
137+
workingDir '/home/irina/tensorflow'
138+
commandLine bazelLocation, 'build', '-c', 'opt', \
139+
'tensorflow/examples/android:tensorflow_native_libs', \
140+
'--crosstool_top=//external:android/crosstool', \
141+
'--cpu=' + cpuType, \
142+
'--host_crosstool_top=@bazel_tools//tools/cpp:toolchain'
143+
}
144+
145+
task buildNativeMake(type: Exec) {
146+
environment "NDK_ROOT", android.ndkDirectory
147+
// Tip: install ccache and uncomment the following to speed up
148+
// builds significantly.
149+
// environment "CC_PREFIX", 'ccache'
150+
workingDir '/home/irina/tensorflow'
151+
commandLine 'tensorflow/contrib/makefile/build_all_android.sh', \
152+
'-s', \
153+
'tensorflow/contrib/makefile/sub_makefiles/android/Makefile.in', \
154+
'-t', \
155+
'libtensorflow_inference.so libtensorflow_demo.so' \
156+
//, '-T' // Uncomment to skip protobuf and speed up subsequent builds.
157+
}
158+
159+
task copyNativeLibs(type: Copy) {
160+
from demoLibPath
161+
from inferenceLibPath
162+
into nativeOutDir
163+
duplicatesStrategy = 'include'
164+
dependsOn nativeBuildRule
165+
fileMode 0644
166+
}
167+
168+
tasks.whenTaskAdded { task ->
169+
if (nativeBuildSystem == 'bazel' || nativeBuildSystem == 'makefile') {
170+
if (task.name == 'assembleDebug') {
171+
task.dependsOn 'copyNativeLibs'
172+
}
173+
if (task.name == 'assembleRelease') {
174+
task.dependsOn 'copyNativeLibs'
175+
}
176+
}
177+
}
178+
179+
dependencies {
180+
compile fileTree(include: ['*.jar'], dir: 'libs')
181+
androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
182+
exclude group: 'com.android.support', module: 'support-annotations'
183+
})
184+
compile 'com.android.support.constraint:constraint-layout:1.0.2'
185+
compile 'com.android.support:appcompat-v7:27.0.2'
186+
testCompile 'junit:junit:4.12'
187+
compile 'org.tensorflow:tensorflow-android:+'
188+
compile 'com.wonderkiln:camerakit:0.13.1'
189+
}

gradle.properties

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
# Project-wide Gradle settings.
3+
4+
# IDE (e.g. Android Studio) users:
5+
# Gradle settings configured through the IDE *will override*
6+
# any settings specified in this file.
7+
8+
# For more details on how to configure your build environment visit
9+
# http://www.gradle.org/docs/current/userguide/build_environment.html
10+
11+
# Specifies the JVM arguments used for the daemon process.
12+
# The setting is particularly useful for tweaking memory settings.
13+
org.gradle.jvmargs=-Xmx1536m
14+
15+
# When configured, Gradle will run in incubating parallel mode.
16+
# This option should only be used with decoupled projects. More details, visit
17+
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18+
# org.gradle.parallel=true

gradle/wrapper/gradle-wrapper.jar

52.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)