Comments (4)
Well, I've been searching all over the place and finally I've figured it out. It's dead simple.
For some reason I thought that AssetFileDescriptor
's getStartOffset
is related to the actual tflite model
but it's not. I think the getStartOffset
gives the start
point of the file in the application's asset. And for the tflite model
the startOffset
should be 0
because that's where the file start as it is only one file.
So, the code should be
File file = new File('path_to_model');
FileInputStream is = new FileInputStream(file);
return is.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, file.length());
from android-tensorflow-lite-example.
I have the same problem
from android-tensorflow-lite-example.
Hi, I have a similar issue. Has anyone figured out how to solve it?
from android-tensorflow-lite-example.
File modelFile = new File(this.modelPath);
FileChannel channel = new FileInputStream(modelFile).getChannel();
interpreterInference = new Interpreter(channel.map(FileChannel.MapMode.READ_ONLY, 0, modelFile.length()), new Interpreter.Options());
This does load the model. Without any issue. But it arises a new problem which is
Caused by: java.lang.IllegalStateException: Internal error: Unexpected failure when preparing tensor allocations: tensorflow/lite/kernels/conv.cc:237 input->dims->size != 4 (1 != 4)Node number 0 (CONV_2D) failed to prepare.
at org.tensorflow.lite.NativeInterpreterWrapper.allocateTensors(Native Method)
Well I guess that's because of the input tensor size (shape) I have to reshape the image I suppose.
from android-tensorflow-lite-example.
Related Issues (20)
- it's really amazing!
- Replaced the model and the label but it Crashes! HOT 2
- No toolchains found in the NDK toolchains folder for ABI with prefix: mips64el-linux-android HOT 1
- Support for Multibox detector in application please..!
- Enabling GPU support on Android for Yolov2
- increase image size and quality HOT 1
- change model to .tflite file
- cant find the link HOT 1
- How to change input from single image to stream. Does cameraKit allow that?
- FATAL ERROR - no implementation found HOT 1
- The common object detection accuracy is poor when deployed a default tflite in mobile
- image size with new model
- Code is not working with inceptionV3 model [cannot convert an tensorflowlite tensor with type float32 to a java object of type [[b (which is compatible with the tensorflowlite type uint8)] HOT 4
- I want to do DetectAcitivty Demo what Can I do ? HOT 1
- Image Scanner activity not close on finish() and onBackPressed() not working HOT 1
- Cannot convert between a TensorFlowLite buffer with XXX bytes and a ByteBuffer with XXX bytes HOT 22
- Could I re-train it with my own datasets? HOT 4
- FATAL EXCEPTION - pool-1-thread-1 HOT 3
- CreateProcess error=2, The system cannot find the file specified HOT 1
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 android-tensorflow-lite-example.