Giter VIP home page Giter VIP logo

Comments (6)

am15h avatar am15h commented on June 7, 2024

Hi @prakashssp077, Can you please share some reproducible code.

from tflite_flutter_helper.

yaizudamashii avatar yaizudamashii commented on June 7, 2024

I had this when I tried to run PoseNet on an image, the precondition fails where inputTensor bytelength is 4x the input byte's length.

from tflite_flutter_helper.

yaizudamashii avatar yaizudamashii commented on June 7, 2024

It seems that when loading the model from asset, _tensor in interpreter.dart already has 4x the number of bytes and trying to resizeInputTensor fails

from tflite_flutter_helper.

yaizudamashii avatar yaizudamashii commented on June 7, 2024

@am15h Actually I am getting a similar error, even without doing anything.

I/tflite  ( 5512): Initialized TensorFlow Lite runtime.
I/flutter ( 5512): Interpreter Created Successfully
I/flutter ( 5512): Labels loaded successfully
I/flutter ( 5512): Time to load image: 51 ms
E/tflite  ( 5512): tensorflow/lite/kernels/reshape.cc:66 num_input_elements != num_output_elements (4004 != 1001)
E/tflite  ( 5512): Node number 29 (RESHAPE) failed to prepare.
E/flutter ( 5512): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: Bad state: failed precondition
E/flutter ( 5512): #0      checkState (package:quiver/check.dart:74:5)
E/flutter ( 5512): #1      Interpreter.allocateTensors (package:tflite_flutter/src/interpreter.dart:142:5)
E/flutter ( 5512): #2      Interpreter.runForMultipleInputs (package:tflite_flutter/src/interpreter.dart:181:7)
E/flutter ( 5512): #3      Interpreter.run (package:tflite_flutter/src/interpreter.dart:157:5)
E/flutter ( 5512): #4      Classifier.predict (package:imageclassification/classifier.dart:97:17)
E/flutter ( 5512): #5      _MyHomePageState._predict (package:imageclassification/main.dart:67:28)
E/flutter ( 5512): #6      _MyHomePageState.getImage.<anonymous closure> (package:imageclassification/main.dart:61:7)
E/flutter ( 5512): #7      State.setState (package:flutter/src/widgets/framework.dart:1088:30)
E/flutter ( 5512): #8      _MyHomePageState.getImage (package:imageclassification/main.dart:57:5)
E/flutter ( 5512): <asynchronous suspension>
E/flutter ( 5512): 

Steps to reproduce:

  1. clone the repository
  2. run sh install.sh from example/image_classification
  3. build example/image_classification on Android emulator
  4. load any image from the emulator by tapping the bottom right button

from tflite_flutter_helper.

yaizudamashii avatar yaizudamashii commented on June 7, 2024

Ok false alarm, I had changed the package code and had to repair it using
flutter pub cache repair

from tflite_flutter_helper.

Priyanshu078 avatar Priyanshu078 commented on June 7, 2024

@yaizudamashii were you able to solve the above error of failed precondition

from tflite_flutter_helper.

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.