Comments (9)
Are you trying this on an emulator or a real device?
from flutter-tflite.
Are you trying this on an emulator or a real device?
Real device :
Tried on two phones : Redmi note 7 pro (Qualcomm Snapdragon 675) and Redmi Note 10 (Qualcomm SDM678 Snapdragon)
from flutter-tflite.
While fixing i found out that the tflite version used by plugin in 2.12.0
and my model tflite version is 2.5.0
Is this the reason of my model not working with gpudelegate properly and giving low performance ?
plugin build gradle :
// The Android Gradle Plugin builds the native code with the Android NDK.
group 'org.tensorflow.tflite_flutter'
version '1.0'
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
// The Android Gradle Plugin knows how to build native code with the NDK.
classpath 'com.android.tools.build:gradle:7.3.0'
}
}
rootProject.allprojects {
repositories {
google()
mavenCentral()
}
}
apply plugin: 'com.android.library'
android {
// Bumping the plugin compileSdkVersion requires all clients of this plugin
// to bump the version in their app.
compileSdkVersion 31
// Bumping the plugin ndkVersion requires all clients of this plugin to bump
// the version in their app and to download a newer version of the NDK.
// ndkVersion "23.1.7779620"
// Invoke the shared CMake build with the Android Gradle Plugin.
externalNativeBuild {
// cmake {
// path "../src/CMakeLists.txt"
// // The default CMake version for the Android Gradle Plugin is 3.10.2.
// // https://developer.android.com/studio/projects/install-ndk#vanilla_cmake
// //
// // The Flutter tooling requires that developers have CMake 3.10 or later
// // installed. You should not increase this version, as doing so will cause
// // the plugin to fail to compile for some customers of the plugin.
// // version "3.10.2"
// }
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
defaultConfig {
minSdkVersion 19
}
}
dependencies {
def tflite_version = "2.12.0"
implementation("org.tensorflow:tensorflow-lite:${tflite_version}")
implementation("org.tensorflow:tensorflow-lite-gpu:${tflite_version}")
}
from flutter-tflite.
If your model can run on CPU. Probably some operators are not supported by GPU. Maybe you can try to do GPU compatibility analysis when you do the Tflite model converting. https://www.tensorflow.org/lite/guide/model_analyzer
from flutter-tflite.
yup i tried it ,the model i am using is not compatible with GPU
from flutter-tflite.
@xyzacademic I am using a cnn custom tensorflow model with input 1 x 512 x 320 x 3 for corner detection ,it is working good on mid and high end devices but not good with low end (1 sec latency) ,any way to fix this ? Thats the reason why i was trying to use GpuDelegate
from flutter-tflite.
@xyzacademic I am using a cnn custom tensorflow model with input 1 x 512 x 320 x 3 for corner detection ,it is working good on mid and high end devices but not good with low end (1 sec latency) ,any way to fix this ? Thats the reason why i was trying to use GpuDelegate
I suggest designing the network with GPU-compatible operators. This is what I did. Maybe there is any other way I don't know.
from flutter-tflite.
@xyzacademic I am using a cnn custom tensorflow model with input 1 x 512 x 320 x 3 for corner detection ,it is working good on mid and high end devices but not good with low end (1 sec latency) ,any way to fix this ? Thats the reason why i was trying to use GpuDelegate
I suggest designing the network with GPU-compatible operators. This is what I did. Maybe there is any other way I don't know.
how much improvement did u get before and after ?
from flutter-tflite.
The performance improvement of migrating CPU to GPU? Maybe twice faster. It depends on the model.
Also, if the phone call runs the model frequently, overheating will lower the performance and result in laggy.
from flutter-tflite.
Related Issues (20)
- Not able to run the model directly on image
- Support for Hexagon Delegate?
- Cannot get yamnet features in flutter
- E/flutter (30995): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument(s): Output object shape mismatch, interpreter returned output of shape: [1, 84, 8400] while shape of output provided as argument in run is: [8400, 4] HOT 2
- The inference speed using the old version is 5-8 times faster than the latest version HOT 7
- null check operator used on a null value HOT 1
- IOS release version does't work HOT 2
- Using GPU for tflite
- Model far less accurate when testing with example code
- Why flutter-tflite doesn't support flutter web HOT 3
- Undefined name 'TfLiteGpuInferenceUsage' and 'TfLiteGpuInferencePrioFrity'. HOT 1
- support for the CUDA platform of NVIDIA graphics cards HOT 2
- Is it possible to run more then one TFLite models at the same time on a Flutter App HOT 1
- NNAPI delegate HOT 1
- Model missing in live object detection
- How can I load a tflite model using Isolate? HOT 1
- Super slow inference speed for a certain model
- Unhandled exception: type 'List<double>' is not a subtype of type 'List<int>' of 'value' HOT 1
- Build issue with old version
- Need help for super-resolution for onnx like tflite implemention (Not issue)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter-tflite.