Code Monkey home page Code Monkey logo

Comments (8)

amkmpro avatar amkmpro commented on July 22, 2024 3

Thank you, it ran finally.

org.tensorflow:tensorflow-lite-support:0.1.0
LCE package:0.6.2
Gradle:4.2.0

from compute-engine.

CNugteren avatar CNugteren commented on July 22, 2024 1

You'll have to make both changes, not one of the two:

I could resolve this issue by using an older version of the LCE package (0.6.2 instead of 0.7.0) and by changing org.tensorflow:tensorflow-lite-support:0.3.0 back to org.tensorflow:tensorflow-lite-support:0.1.0.

Or at least, that's what I did to make it work.

from compute-engine.

CNugteren avatar CNugteren commented on July 22, 2024

I could not reproduce this issue. I took a fresh clone of the TensorFlow examples repository, then followed the steps up to the point where this exclude is added. Then I tried to build the project and I don't see any issues when I run Make Project. My git diff at this point looks like this:

diff --git a/lite/examples/image_classification/android/build.gradle b/lite/examples/image_classification/android/build.gradle
index c0602307..5ca4a13c 100644
--- a/lite/examples/image_classification/android/build.gradle
+++ b/lite/examples/image_classification/android/build.gradle
@@ -18,6 +18,7 @@ allprojects {
     repositories {
         google()
         mavenCentral()
+        mavenLocal()
         maven {
             name 'ossrh-snapshot'
             url 'https://oss.sonatype.org/content/repositories/snapshots'
diff --git a/lite/examples/image_classification/android/lib_support/build.gradle b/lite/examples/image_classification/android/lib_support/build.gradle
index 87cb34ad..3d27b5d0 100644
--- a/lite/examples/image_classification/android/lib_support/build.gradle
+++ b/lite/examples/image_classification/android/lib_support/build.gradle
@@ -38,11 +38,14 @@ dependencies {
     implementation project(":models")
     implementation 'androidx.appcompat:appcompat:1.1.0'
 
+    implementation 'org.larq:lce-lite:0.1.000'
     // Build off of nightly TensorFlow Lite
-    implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT'
+    // implementation 'org.tensorflow:tensorflow-lite:0.0.0-nightly-SNAPSHOT'
     implementation 'org.tensorflow:tensorflow-lite-gpu:0.0.0-nightly-SNAPSHOT'
 
-    implementation 'org.tensorflow:tensorflow-lite-support:0.3.0'
+    implementation ('org.tensorflow:tensorflow-lite-support:0.3.0') {
+        exclude module: 'tensorflow-lite'
+    }
 
     // Use local TensorFlow library
     // implementation 'org.tensorflow:tensorflow-lite-local:0.0.0'

When exactly do you see this message, during the project build or at runtime?

from compute-engine.

amkmpro avatar amkmpro commented on July 22, 2024

Thank you for replay.
I founded that I used org.tensorflow:tensorflow-lite-support:0.1.0 and there isn't org.tensorflow.lite.DataType in version: 0.1.0, hence I changed it to org.tensorflow:tensorflow-lite-support:0.3.0 and I run Make Project without error. When I run it on device, it closed rapidly.
May you run it?

from compute-engine.

CNugteren avatar CNugteren commented on July 22, 2024

Indeed, for me it also crashes. Did you do all the next steps in the tutorial as well (specifying the model, adding it to the assets folder, etc.)? And what error did you get (you can see it in the logcat tab)? For me it errors with:

java.lang.NoSuchMethodError: No virtual method getNumThreads()I in class Lorg/tensorflow/lite/InterpreterImpl$Options; or its super classes (declaration of 'org.tensorflow.lite.InterpreterImpl$Options' appears in /data/app/~~3FKaP-HEhZueK6nrT2DUBQ==/org.tensorflow.lite.examples.classification-09a2my7j7KeKrfH4KmjP9Q==/base.apk)

I could resolve this issue by using an older version of the LCE package (0.6.2 instead of 0.7.0) and by changing org.tensorflow:tensorflow-lite-support:0.3.0 back to org.tensorflow:tensorflow-lite-support:0.1.0.

This is an acceptable work-around I think, but we need to fix this properly for the long-term. I guess the LCE .aar release script needs some modifications to be compatible with the 0.3.0 version of tensorflow-lite-support. I'll update here when that is solved, however that will not be on our high-priority list.

from compute-engine.

amkmpro avatar amkmpro commented on July 22, 2024

Unfortunately, I have same error. But your solution doesn't work for me, because I mentioned before, when I use org.tensorflow:tensorflow-lite-support:0.1.0 in classifier.java (under lib_support ) doesn't import 'org.tensorflow.lite.DataType'.

from compute-engine.

CNugteren avatar CNugteren commented on July 22, 2024

If you still get that some error, you most likely didn't downgrade the LCE package properly. As I said above, you'll need an older version of the LCE package (0.6.2 instead of 0.7.0). Then re-run the mvn install command (I gave it a new version number and also updated that in the gradle file, but not sure if that's needed).

from compute-engine.

amkmpro avatar amkmpro commented on July 22, 2024

Thank you again for your reply.
I used org.tensorflow:tensorflow-lite-support:0.3.0 and LCE package 0.6.2. But, there are many duplication classes when I run Make Project.

Duplicate class org.tensorflow.lite.DataType found in modules jetified-lce-lite-v0.6.2-runtime (lce-lite-v0.6.2.aar) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.DataType$1 found in modules jetified-lce-lite-v0.6.2-runtime (lce-lite-v0.6.2.aar) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.Delegate found in modules jetified-lce-lite-v0.6.2-runtime (lce-lite-v0.6.2.aar) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.Tensor found in modules jetified-lce-lite-v0.6.2-runtime (lce-lite-v0.6.2.aar) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.Tensor$QuantizationParams found in modules jetified-lce-lite-v0.6.2-runtime (lce-lite-v0.6.2.aar) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)
Duplicate class org.tensorflow.lite.annotations.UsedByReflection found in modules jetified-lce-lite-v0.6.2-runtime (lce-lite-v0.6.2.aar) and jetified-tensorflow-lite-api-2.7.0-runtime (org.tensorflow:tensorflow-lite-api:2.7.0)

from compute-engine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.