Problem adding a TFLite model to Android Studio - android

I am currently working on an android project where I want to add a TFLite model. I searched how to do so and found the common way is to add it from File-->New-->Other-->TensorFlow Lite Model. The problem is the TensorFlow Lite Model option is greyed out as shown in the image 1 in my android studio. Tried to upgrade my gradle plugin version but it didn't seem to solve the problem.

Related

Cannot import tensorflow lite model on android studio. This is not a valid TensorFlow Lite model file

I'm trying to import a tensorflow lite model into my android studio. I've followed the documentation all along. I have exported a correct tensorflow lite model with an extension .tflite on it but in android studio it says that it is an invalid file.
This is not a valid TensorFlow Lite Model file.
On the import window. I'm really confused why is this happening. I've searched through forums everywhere, they said it is because of my android studio is not 4.2. I've updated it but it still cannot work. I'm really stuck in this and don't know what to do. Can anyone who have experienced this problem share your solution? Or is there any possible ways to deploy my model into my android project? I've tried firebase ML kit but it says maximum limit is 40MB while my model is 160MB. Then its suggesting me to bundle the app into the local but then again the documentation is deprecated and so basically I can't use it.
Would really appreciate anyone's answer here
UPDATE:
Here's the public link to the tflite file that you can download https://drive.google.com/drive/folders/1aGeg0SJHCsGT7yvkny-8ijPKGYZJqODE?usp=sharing

How can I integrate OpenCV-Android-SDK 4.0 with Android studio 3.4?

I'm setting up an android application for object detection and I want to deploy tflite into the project.
I want to use OpenCV library with Android Studio.
I didn't find any instructions or documentation talking about it.
I have found how can I use OpenCV 3.1.0 with a previous version of Android Studio ( 2.*) on StackOverflow.
But I did not find any good explanation for the usage and the integration of the library.
Actually, the problem is the UI is totally different between the two versions.
How can I integrate OpenCV-android-SDK 4.0 with Android Studio 3.4.1?

Tensorflow Retrained Model Behaves Differently on Android Device

I have retrained the model with some custom images as explained in the tensorflow for poets tutorial.
When I run the model on my computer with the below command
python -m scripts.label_image --graph=tf_files/retrained_graph.pb --image=tf_files/test_photos/apple.jpg
I am expecting it to classify as an apple and I get the correct classification result which is:
apple 1.0 orange 1.40016e-08 lemon 2.19029e-09
When I copy the retrained model and the label file to android studio's assets folder and build the apk, I get different classification results even though I am providing the same image to the model.
See the image of the classification result from the app that is built using the same model
I thought the problem was caused by the different tensorflow versions of anaconda and android studio. Therefore, I upgraded the tensorflow version to 1.7.0 to build the model and in android studio tensorflow's dependencies are
compile 'org.tensorflow:tensorflow-android:+'
I also tried the dependency
compile 'org.tensorflow:tensorflow-android:1.7.0'
But I received another error and app crashed immediately after launching so I had to turn back to
'org.tensorflow:tensorflow-android:+'
At the end, even though the optimization and quantization was done, I couldn't make it work with tensorflow for mobile. Same image on mobile and on computer outputed completely different results.
Therefore, I changed to Tensorflow Lite. With tensorflow lite my problem is solved. One short note: Tensorflow lite is not supported on windows (especially toco), therefore I had to use ubuntu.

Adding custom project wizard to Android Studio

I'm trying to develop a plugin for Android Studio to add a new type of project to the selection of project wizards. Unfortunately it seems like Android Studio blocks every project wizard besides the one for Android projects. So far I already have a solution which works well in IntelliJ but not in AS. I already took a look at this question but as I am trying to create a new wizard instead of reactivating an existing one I hope there might be a solution for that.
For everyone trying to convince me to use IntelliJ IDEA with Android Plugin instead: unfortunately this is not and option as I have to stick to Android Studio.
tl;dr: trying to create a project wizard in Android Studio. Works in Intellij IDEA but not in Android Studio.

using AndEngine in Android Studio 0.2.10

I'm trying to develop application's Android platform, so far I have programmed in PHP / MySQL, VB.Net, C #, and I have extensive knowledge and experience in this area, I decided to go in developing applications for Android (some of my clients have requirements for such applications). Programming for android I choose android studio (perhaps my decision is wrong), I use the latest version of Android studio (0.2.10) and I install all the SDK and ADT (following the tutorials I googled) and it works.
But currently I am suffering with the installation of AndEngine to Android Studio and compile in AndEngine in Android Studio
I'm trying to add the latest version of AndEngine from github again following tutorials (I googled for it)
Does anyone have any instructions on how to use AndEngine Android Studio 0.2.10, because everything I googled is for older versions of Android studios and i can't get andengine.jar file (which i need ) that can later be used in the studio as Android library
Excuse my bad English (if)
Here is a sample project I used to get AndEngine working in Android Studio.
https://github.com/janebabra/TowerofHanoiProject
All you have to do is add the andengine.jar to your own project and reference it in the project and the Gradle build config.
Hope that helps

Categories

Resources