Skip to content

Commit

Permalink
Removed GPU support to reduce size
Browse files Browse the repository at this point in the history
  • Loading branch information
arefbhrn committed May 19, 2020
1 parent bba90ba commit 1b7a710
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 25 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "dev.aref.irdebitcardscanner.example"
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0.0"
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

Expand Down Expand Up @@ -37,7 +37,7 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'com.android.tools.build:gradle:3.6.3'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Sep 27 08:30:51 PDT 2019
#Wed May 20 02:22:55 IRDT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
14 changes: 7 additions & 7 deletions lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
defaultConfig {
minSdkVersion 17
targetSdkVersion 29
versionCode 1
versionName "1.0.0"
versionCode 2
versionName "1.0.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
renderscriptTargetApi 18
renderscriptSupportModeEnabled true
Expand All @@ -27,12 +27,12 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.test.espresso:espresso-idling-resource:3.2.0'
implementation 'org.tensorflow:tensorflow-lite:2.0.0'
implementation 'org.tensorflow:tensorflow-lite-gpu:2.0.0'
implementation 'org.tensorflow:tensorflow-lite:2.2.0'
// implementation 'org.tensorflow:tensorflow-lite-gpu:2.2.0'
}

install {
Expand All @@ -41,12 +41,12 @@ install {
name 'IRDebitCardScanner'
description 'Iranian Debit Card Scanner using Deep Learning and TensorFlow Lite for Android'
url 'https://github.com/arefbhrn/IRDebitCardScanner'
inceptionYear '2019'
inceptionYear '2020'

packaging 'aar'
groupId 'com.arefbhrn.libraries'
artifactId 'IRDebitCardScanner'
version '1.0.0'
version '1.0.1'

licenses {
license {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import android.util.Log;

import org.tensorflow.lite.Interpreter;
import org.tensorflow.lite.gpu.GpuDelegate;

import java.io.IOException;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -72,7 +71,7 @@ abstract class ImageClassifier {
/**
* holds a gpu delegate
*/
private GpuDelegate gpuDelegate = null;
// private GpuDelegate gpuDelegate = null;

/**
* Initializes an {@code ImageClassifier}.
Expand Down Expand Up @@ -119,11 +118,11 @@ public void useCPU() {
}

public void useGpu() {
if (gpuDelegate == null) {
gpuDelegate = new GpuDelegate();
tfliteOptions.addDelegate(gpuDelegate);
recreateInterpreter();
}
// if (gpuDelegate == null) {
// gpuDelegate = new GpuDelegate();
// tfliteOptions.addDelegate(gpuDelegate);
// recreateInterpreter();
// }
}

public void useNNAPI() {
Expand All @@ -142,10 +141,10 @@ public void setNumThreads(int numThreads) {
public void close() {
tflite.close();
tflite = null;
if (gpuDelegate != null) {
gpuDelegate.close();
gpuDelegate = null;
}
// if (gpuDelegate != null) {
// gpuDelegate.close();
// gpuDelegate = null;
// }
tfliteModel = null;
}

Expand Down

0 comments on commit 1b7a710

Please sign in to comment.