├── .idea └── vcs.xml ├── AndroidManifest.xml ├── BUILD ├── README.md ├── build.gradle ├── download-models.gradle ├── gradle.properties ├── gradlew ├── gradlew.bat ├── libs └── libandroid_tensorflow_inference_java.jar ├── local.properties ├── res ├── drawable-hdpi │ ├── ic_action_info.png │ ├── ic_launcher.png │ └── tile.9.png ├── drawable-mdpi │ ├── ic_action_info.png │ └── ic_launcher.png ├── drawable-xhdpi │ ├── ic_action_info.png │ └── ic_launcher.png ├── drawable-xxhdpi │ ├── ic_action_info.png │ └── ic_launcher.png ├── layout │ ├── activity_camera.xml │ ├── activity_photo_stylize.xml │ ├── camera_connection_fragment.xml │ ├── camera_connection_fragment_stylize.xml │ └── camera_connection_fragment_tracking.xml ├── values-sw600dp │ ├── template-dimens.xml │ └── template-styles.xml ├── values-v11 │ ├── styles.xml │ └── template-styles.xml ├── values-v14 │ └── styles.xml ├── values-v21 │ ├── base-colors.xml │ └── base-template-styles.xml ├── values-w820dp │ └── dimens.xml └── values │ ├── attrs.xml │ ├── base-strings.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ ├── styles.xml │ ├── template-dimens.xml │ └── template-styles.xml ├── sample_images ├── classify1.jpg ├── detect1.jpg ├── photo1.png └── stylize1.jpg └── src └── org └── tensorflow └── demo ├── AutoFitTextureView.java ├── CameraActivity.java ├── CameraConnectionFragment.java ├── Classifier.java ├── ClassifierActivity.java ├── DetectorActivity.java ├── OverlayView.java ├── PhotoStylizeActivity.java ├── RecognitionScoreView.java ├── ResultsView.java ├── StylizeActivity.java ├── TensorFlowImageClassifier.java ├── TensorFlowMultiBoxDetector.java ├── TensorFlowYoloDetector.java ├── env ├── BorderedText.java ├── ImageUtils.java ├── Logger.java ├── Size.java └── SplitTimer.java ├── tracking ├── MultiBoxTracker.java └── ObjectTracker.java └── util ├── BitmapUtil.java ├── FileUtil.java └── MediaScanner.java /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 16 | 18 | 19 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 39 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /BUILD: -------------------------------------------------------------------------------- 1 | # Description: 2 | # TensorFlow camera demo app for Android. 3 | 4 | package(default_visibility = ["//visibility:public"]) 5 | 6 | licenses(["notice"]) # Apache 2.0 7 | 8 | load( 9 | "//tensorflow:tensorflow.bzl", 10 | "tf_copts", 11 | "tf_opts_nortti_if_android", 12 | ) 13 | 14 | exports_files(["LICENSE"]) 15 | 16 | LINKER_SCRIPT = "//tensorflow/contrib/android:jni/version_script.lds" 17 | 18 | # libtensorflow_demo.so contains the native code for image colorspace conversion 19 | # and object tracking used by the demo. It does not require TF as a dependency 20 | # to build if STANDALONE_DEMO_LIB is defined. 21 | # TF support for the demo is provided separately by libtensorflow_inference.so. 22 | cc_binary( 23 | name = "libtensorflow_demo.so", 24 | srcs = glob([ 25 | "jni/**/*.cc", 26 | "jni/**/*.h", 27 | ]), 28 | copts = tf_copts(), 29 | defines = ["STANDALONE_DEMO_LIB"], 30 | linkopts = [ 31 | "-landroid", 32 | "-ljnigraphics", 33 | "-llog", 34 | "-lm", 35 | "-z defs", 36 | "-s", 37 | "-Wl,--version-script", # This line must be directly followed by LINKER_SCRIPT. 38 | LINKER_SCRIPT, 39 | ], 40 | linkshared = 1, 41 | linkstatic = 1, 42 | tags = [ 43 | "manual", 44 | "notap", 45 | ], 46 | deps = [ 47 | LINKER_SCRIPT, 48 | ], 49 | ) 50 | 51 | cc_library( 52 | name = "tensorflow_native_libs", 53 | srcs = [ 54 | ":libtensorflow_demo.so", 55 | "//tensorflow/contrib/android:libtensorflow_inference.so", 56 | ], 57 | tags = [ 58 | "manual", 59 | "notap", 60 | ], 61 | ) 62 | 63 | android_binary( 64 | name = "tensorflow_demo", 65 | srcs = glob([ 66 | "src/**/*.java", 67 | ]), 68 | # Package assets from assets dir as well as all model targets. Remove undesired models 69 | # (and corresponding Activities in source) to reduce APK size. 70 | assets = [ 71 | "//tensorflow/examples/android/assets:asset_files", 72 | ":external_assets", 73 | ], 74 | assets_dir = "", 75 | custom_package = "org.tensorflow.demo", 76 | inline_constants = 1, 77 | manifest = "AndroidManifest.xml", 78 | manifest_merger = "legacy", 79 | resource_files = glob(["res/**"]), 80 | tags = [ 81 | "manual", 82 | "notap", 83 | ], 84 | deps = [ 85 | ":tensorflow_native_libs", 86 | "//tensorflow/contrib/android:android_tensorflow_inference_java", 87 | ], 88 | ) 89 | 90 | # LINT.IfChange 91 | filegroup( 92 | name = "external_assets", 93 | srcs = [ 94 | "@inception5h//:model_files", 95 | "@mobile_multibox//:model_files", 96 | "@stylize//:model_files", 97 | ], 98 | ) 99 | # LINT.ThenChange(//tensorflow/examples/android/download-models.gradle) 100 | 101 | filegroup( 102 | name = "all_files", 103 | srcs = glob( 104 | ["**/*"], 105 | exclude = [ 106 | "**/METADATA", 107 | "**/OWNERS", 108 | "bin/**", 109 | "gen/**", 110 | "gradleBuild/**", 111 | "libs/**", 112 | ], 113 | ), 114 | visibility = ["//tensorflow:__subpackages__"], 115 | ) 116 | 117 | filegroup( 118 | name = "java_files", 119 | srcs = glob(["src/**/*.java"]), 120 | ) 121 | 122 | filegroup( 123 | name = "jni_files", 124 | srcs = glob([ 125 | "jni/**/*.cc", 126 | "jni/**/*.h", 127 | ]), 128 | ) 129 | 130 | filegroup( 131 | name = "resource_files", 132 | srcs = glob(["res/**"]), 133 | ) 134 | 135 | exports_files(["AndroidManifest.xml"]) 136 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | TensorFlow官方Android端示例中,风格迁移TF Stylize是对摄像头获取的画面动态渲染, 3 | ### 4 | 本人渣机运行起来非常卡,基本看不出效果,因此改为对图片进行风格迁移。 5 | 6 | 截图 7 | ----------------------------------- 8 | ![image](https://github.com/SimonCherryGZ/TensorFlow_Android/raw/master/sample_images/photo1.png) 9 | 10 | 11 | > Written with [StackEdit](https://stackedit.io/). 12 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | // This file provides basic support for building the TensorFlow demo 2 | // in Android Studio with Gradle. 3 | // 4 | // Note that Bazel is still used by default to compile the native libs, 5 | // and should be installed at the location noted below. This build file 6 | // automates the process of calling out to it and copying the compiled 7 | // libraries back into the appropriate directory. 8 | // 9 | // Alternatively, experimental support for Makefile builds is provided by 10 | // setting buildWithMake below to true. This will allow building the demo 11 | // on Windows machines, but note that full equivalence with the Bazel 12 | // build is not yet guaranteed. See comments below for caveats and tips 13 | // for speeding up the build, such as as enabling ccache. 14 | 15 | // Set to true to build with make. 16 | // NOTE: Running a make build will cause subsequent Bazel builds to *fail* 17 | // unless the contrib/makefile/downloads/ and gen/ dirs are deleted afterwards. 18 | def buildWithMake = false 19 | 20 | // Controls output directory in APK and CPU type for Bazel builds. 21 | // NOTE: Does not affect the Makefile build target API (yet), which currently 22 | // assumes armeabi-v7a. If building with make, changing this will require 23 | // editing the Makefile as well. 24 | def cpuType = 'armeabi-v7a' 25 | 26 | // Output directory in the local directory for packaging into the APK. 27 | def nativeOutDir = 'libs/' + cpuType 28 | 29 | // Default to building with Bazel and override with make if requested. 30 | def nativeBuildRule = 'buildNativeBazel' 31 | def demoLibPath = '../../../bazel-bin/tensorflow/examples/android/libtensorflow_demo.so' 32 | def inferenceLibPath = '../../../bazel-bin/tensorflow/contrib/android/libtensorflow_inference.so' 33 | if (buildWithMake) { 34 | nativeBuildRule = 'buildNativeMake' 35 | demoLibPath = '../../../tensorflow/contrib/makefile/gen/lib/libtensorflow_demo.so' 36 | inferenceLibPath = '../../../tensorflow/contrib/makefile/gen/lib/libtensorflow_inference.so' 37 | } 38 | 39 | // Defines the NDK location for Makefile builds. Does *not* affect Bazel builds. 40 | // Override with your absolute NDK location if this fails to get the location 41 | // automatically. 42 | def makeNdkRoot = System.getenv('NDK_ROOT') 43 | 44 | // If building with Bazel, this is the location of the bazel binary. 45 | // NOTE: Bazel does not yet support building for Android on Windows, 46 | // so in this case the Makefile build must be used as described above. 47 | def bazelLocation = '/usr/local/bin/bazel' 48 | 49 | project.buildDir = 'gradleBuild' 50 | getProject().setBuildDir('gradleBuild') 51 | 52 | // import DownloadModels task 53 | project.ext.ASSET_DIR = projectDir.toString() + '/assets' 54 | project.ext.TMP_DIR = project.buildDir.toString() + '/downloads' 55 | 56 | buildscript { 57 | repositories { 58 | jcenter() 59 | } 60 | 61 | dependencies { 62 | classpath 'com.android.tools.build:gradle:2.3.0' 63 | } 64 | } 65 | 66 | apply plugin: 'com.android.application' 67 | 68 | android { 69 | compileSdkVersion 23 70 | buildToolsVersion "25.0.1" 71 | 72 | lintOptions { 73 | abortOnError false 74 | } 75 | 76 | sourceSets { 77 | main { 78 | // TensorFlow Java API sources. 79 | java { 80 | srcDir '../../java/src/main/java' 81 | exclude '**/examples/**' 82 | } 83 | 84 | // Android TensorFlow wrappers, etc. 85 | java { 86 | srcDir '../../contrib/android/java' 87 | } 88 | 89 | // Android demo app sources. 90 | java { 91 | srcDir 'src' 92 | } 93 | 94 | manifest.srcFile 'AndroidManifest.xml' 95 | resources.srcDirs = ['src'] 96 | aidl.srcDirs = ['src'] 97 | renderscript.srcDirs = ['src'] 98 | res.srcDirs = ['res'] 99 | assets.srcDirs = [project.ext.ASSET_DIR] 100 | jniLibs.srcDirs = ['jniLibs'] 101 | } 102 | 103 | debug.setRoot('build-types/debug') 104 | release.setRoot('build-types/release') 105 | } 106 | } 107 | 108 | //task buildNativeBazel(type: Exec) { 109 | // workingDir '../../..' 110 | // commandLine bazelLocation, 'build', '-c', 'opt', \ 111 | // 'tensorflow/examples/android:tensorflow_native_libs', \ 112 | // '--crosstool_top=//external:android/crosstool', \ 113 | // '--cpu=' + cpuType, \ 114 | // '--host_crosstool_top=@bazel_tools//tools/cpp:toolchain' 115 | //} 116 | // 117 | //task buildNativeMake(type: Exec) { 118 | // environment "NDK_ROOT", makeNdkRoot 119 | // // Tip: install ccache and uncomment the following to speed up 120 | // // builds significantly. 121 | // // environment "CC_PREFIX", 'ccache' 122 | // workingDir '../../..' 123 | // commandLine 'tensorflow/contrib/makefile/build_all_android.sh', \ 124 | // '-s', \ 125 | // 'tensorflow/contrib/makefile/sub_makefiles/android/Makefile.in', \ 126 | // '-t', \ 127 | // 'libtensorflow_inference.so libtensorflow_demo.so' \ 128 | // //, '-T' // Uncomment to skip protobuf and speed up subsequent builds. 129 | //} 130 | // 131 | // 132 | //task copyNativeLibs(type: Copy) { 133 | // from demoLibPath 134 | // from inferenceLibPath 135 | // into nativeOutDir 136 | // duplicatesStrategy = 'include' 137 | // dependsOn nativeBuildRule 138 | // fileMode 0644 139 | //} 140 | // 141 | //assemble.dependsOn copyNativeLibs 142 | //afterEvaluate { 143 | // assembleDebug.dependsOn copyNativeLibs 144 | // assembleRelease.dependsOn copyNativeLibs 145 | //} 146 | 147 | // Download default models; if you wish to use your own models then 148 | // place them in the "assets" directory and comment out this line. 149 | //apply from: "download-models.gradle" 150 | 151 | dependencies { 152 | compile fileTree(include: ['*.jar'], dir: 'libs') 153 | compile 'com.android.support:appcompat-v7:23.4.0' 154 | } 155 | -------------------------------------------------------------------------------- /download-models.gradle: -------------------------------------------------------------------------------- 1 | /* 2 | * download-models.gradle 3 | * Downloads model files from ${MODEL_URL} into application's asset folder 4 | * Input: 5 | * project.ext.TMP_DIR: absolute path to hold downloaded zip files 6 | * project.ext.ASSET_DIR: absolute path to save unzipped model files 7 | * Output: 8 | * 3 model files will be downloaded into given folder of ext.ASSET_DIR 9 | */ 10 | // hard coded model files 11 | // LINT.IfChange 12 | def models = ['inception5h.zip', 13 | 'mobile_multibox_v1a.zip', 14 | 'stylize_v1.zip'] 15 | // LINT.ThenChange(//tensorflow/examples/android/BUILD) 16 | 17 | // Root URL for model archives 18 | def MODEL_URL = 'https://storage.googleapis.com/download.tensorflow.org/models' 19 | 20 | buildscript { 21 | repositories { 22 | jcenter() 23 | } 24 | dependencies { 25 | classpath 'de.undercouch:gradle-download-task:3.2.0' 26 | } 27 | } 28 | 29 | import de.undercouch.gradle.tasks.download.Download 30 | task downloadFile(type: Download){ 31 | for (f in models) { 32 | src "${MODEL_URL}/" + f 33 | } 34 | dest new File(project.ext.TMP_DIR) 35 | overwrite true 36 | } 37 | 38 | task extractModels(type: Copy) { 39 | for (f in models) { 40 | from zipTree(project.ext.TMP_DIR + '/' + f) 41 | } 42 | 43 | into file(project.ext.ASSET_DIR) 44 | fileMode 0644 45 | exclude '**/LICENSE' 46 | 47 | dependsOn downloadFile 48 | } 49 | 50 | afterEvaluate { 51 | // if models are not available, download & unzip them 52 | def needDownload = false 53 | for (f in models) { 54 | if (!(new File(project.ext.TMP_DIR + '/' + f)).exists()) { 55 | needDownload = true 56 | } 57 | } 58 | 59 | if (needDownload) { 60 | assembleDebug.dependsOn extractModels 61 | assembleRelease.dependsOn extractModels 62 | } 63 | } 64 | 65 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | ## Project-wide Gradle settings. 2 | # 3 | # For more details on how to configure your build environment visit 4 | # http://www.gradle.org/docs/current/userguide/build_environment.html 5 | # 6 | # Specifies the JVM arguments used for the daemon process. 7 | # The setting is particularly useful for tweaking memory settings. 8 | # Default value: -Xmx1024m -XX:MaxPermSize=256m 9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 10 | # 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | #Sun Mar 26 13:48:36 GMT+08:00 2017 16 | systemProp.http.proxyHost=127.0.0.1 17 | systemProp.http.proxyPort=1080 18 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # Attempt to set APP_HOME 46 | # Resolve links: $0 may be a link 47 | PRG="$0" 48 | # Need this for relative symlinks. 49 | while [ -h "$PRG" ] ; do 50 | ls=`ls -ld "$PRG"` 51 | link=`expr "$ls" : '.*-> \(.*\)$'` 52 | if expr "$link" : '/.*' > /dev/null; then 53 | PRG="$link" 54 | else 55 | PRG=`dirname "$PRG"`"/$link" 56 | fi 57 | done 58 | SAVED="`pwd`" 59 | cd "`dirname \"$PRG\"`/" >/dev/null 60 | APP_HOME="`pwd -P`" 61 | cd "$SAVED" >/dev/null 62 | 63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 64 | 65 | # Determine the Java command to use to start the JVM. 66 | if [ -n "$JAVA_HOME" ] ; then 67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 68 | # IBM's JDK on AIX uses strange locations for the executables 69 | JAVACMD="$JAVA_HOME/jre/sh/java" 70 | else 71 | JAVACMD="$JAVA_HOME/bin/java" 72 | fi 73 | if [ ! -x "$JAVACMD" ] ; then 74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 75 | 76 | Please set the JAVA_HOME variable in your environment to match the 77 | location of your Java installation." 78 | fi 79 | else 80 | JAVACMD="java" 81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 82 | 83 | Please set the JAVA_HOME variable in your environment to match the 84 | location of your Java installation." 85 | fi 86 | 87 | # Increase the maximum file descriptors if we can. 88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 89 | MAX_FD_LIMIT=`ulimit -H -n` 90 | if [ $? -eq 0 ] ; then 91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 92 | MAX_FD="$MAX_FD_LIMIT" 93 | fi 94 | ulimit -n $MAX_FD 95 | if [ $? -ne 0 ] ; then 96 | warn "Could not set maximum file descriptor limit: $MAX_FD" 97 | fi 98 | else 99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 100 | fi 101 | fi 102 | 103 | # For Darwin, add options to specify how the application appears in the dock 104 | if $darwin; then 105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 106 | fi 107 | 108 | # For Cygwin, switch paths to Windows format before running java 109 | if $cygwin ; then 110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 112 | JAVACMD=`cygpath --unix "$JAVACMD"` 113 | 114 | # We build the pattern for arguments to be converted via cygpath 115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 116 | SEP="" 117 | for dir in $ROOTDIRSRAW ; do 118 | ROOTDIRS="$ROOTDIRS$SEP$dir" 119 | SEP="|" 120 | done 121 | OURCYGPATTERN="(^($ROOTDIRS))" 122 | # Add a user-defined pattern to the cygpath arguments 123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 125 | fi 126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 127 | i=0 128 | for arg in "$@" ; do 129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 131 | 132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 134 | else 135 | eval `echo args$i`="\"$arg\"" 136 | fi 137 | i=$((i+1)) 138 | done 139 | case $i in 140 | (0) set -- ;; 141 | (1) set -- "$args0" ;; 142 | (2) set -- "$args0" "$args1" ;; 143 | (3) set -- "$args0" "$args1" "$args2" ;; 144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 150 | esac 151 | fi 152 | 153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 154 | function splitJvmOpts() { 155 | JVM_OPTS=("$@") 156 | } 157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 159 | 160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 161 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /libs/libandroid_tensorflow_inference_java.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/libs/libandroid_tensorflow_inference_java.jar -------------------------------------------------------------------------------- /local.properties: -------------------------------------------------------------------------------- 1 | ## This file is automatically generated by Android Studio. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must *NOT* be checked into Version Control Systems, 5 | # as it contains information specific to your local configuration. 6 | # 7 | # Location of the SDK. This is only used by Gradle. 8 | # For customization when using a Version Control System, please read the 9 | # header note. 10 | #Sun Mar 26 13:48:34 GMT+08:00 2017 11 | ndk.dir=D\:\\Simon\\Software\\adt-bundle-windows-x86_64-20140321\\sdk\\ndk-bundle 12 | sdk.dir=D\:\\Simon\\Software\\adt-bundle-windows-x86_64-20140321\\sdk 13 | -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-hdpi/ic_action_info.png -------------------------------------------------------------------------------- /res/drawable-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-hdpi/tile.9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-hdpi/tile.9.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-mdpi/ic_action_info.png -------------------------------------------------------------------------------- /res/drawable-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-xhdpi/ic_action_info.png -------------------------------------------------------------------------------- /res/drawable-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_action_info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-xxhdpi/ic_action_info.png -------------------------------------------------------------------------------- /res/drawable-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SimonCherryGZ/TensorFlow_Android/929cf902450ebbff3fc61bc161ceefcab8930342/res/drawable-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /res/layout/activity_camera.xml: -------------------------------------------------------------------------------- 1 | 16 | 23 | -------------------------------------------------------------------------------- /res/layout/activity_photo_stylize.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 18 | 19 | 27 | 28 | 33 | 34 |