Giter VIP home page Giter VIP logo

Comments (9)

gregorscholz avatar gregorscholz commented on May 18, 2024

Are you trying this on an emulator or a real device?

from flutter-tflite.

ayyysh04 avatar ayyysh04 commented on May 18, 2024

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.

ayyysh04 avatar ayyysh04 commented on May 18, 2024

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.

xyzacademic avatar xyzacademic commented on May 18, 2024

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.

ayyysh04 avatar ayyysh04 commented on May 18, 2024

yup i tried it ,the model i am using is not compatible with GPU

from flutter-tflite.

ayyysh04 avatar ayyysh04 commented on May 18, 2024

@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 avatar xyzacademic commented on May 18, 2024

@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.

ayyysh04 avatar ayyysh04 commented on May 18, 2024

@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.

xyzacademic avatar xyzacademic commented on May 18, 2024

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)

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.