Comments (6)
You're right about the value range. My screen shot also come from Netron, but it only snipped part of the screen.
from tflite-support.
The output of https://tfhub.dev/tensorflow/lite-model/mobilenet_v2_1.0_224_quantized/1/metadata/1 is not the probability but logics before softmax. So the range is not [0, 1]. You can apply softmax to the result as needed, or just use it as it is to indicate the probability of a class. I've created an internal bug to track this, and we'll update the documentation of it.
from tflite-support.
I noticed from here
/**
* Constructs a {@link Category} object.
*
* @param label the label of this category object
* @param displayName the display name of the label, which may be translated for different
* locales. For exmaple, a label, "apple", may be translated into Spanish for display purpose,
* so that the displayName is "manzana".
* @param score the probability score of this label category
* @param index the index of the label in the corresponding label file
*/
I guess its meant to be a probability, but this 8.109188 is almost too certain to not be a probability.
Note, also the released code is outdated (0.1.0 the latest release doesn't have index
yet).
from tflite-support.
Oh I see whats happening, it looks like it doesn’t fully support quantised models: e.g. this one: https://tfhub.dev/tensorflow/lite-model/mobilenet_v2_1.0_224_quantized/1/metadata/1
It looks like this library doesn't support quantized models. The output of a quantized model is 0-255 and it fails to convert this into probabilities. I am using the Tensorflow lite task library (ImageClassifier)
from tflite-support.
Task library should support quantized model very well. But this model looks weird. The output range is [-5.7, 0.01], where it should be something like [0, 1]. I'll ask internally what's going here.
from tflite-support.
Thanks @lu-wang-g
I'm curious where you got [-5.7, 0.01] range, i think the max value is 19.48 not 0.01?
I did a small bit of analysis:
When looking at the model in Netron, it looks like output quantization shows: quantization: -5.735767364501953 ≤ 0.09889253973960876 * (q - 58) ≤ 19.481830596923828
. I learnt that the syntax is q_min ≤ q_scale * (q - q_zero_point) ≤ q_max. I'm not able to see the googleplex screenshot link you added: https://screenshot.googleplex.com/BoG2GnB2oLnP2P2.png
Because q can be 0 to 255, the probability outputs are ranged:
- So the lowest value is
0.09889253973960876 * (0 - 58)
, which is-5.735767305
- the highest value is
0.09889253973960876 * (255 - 58)
, which is19.481830329
from tflite-support.
Related Issues (20)
- Getting "Cannot copy to a TensorFlowLite tensor (serving_default_input_1:0) with 63984 bytes from a Java Buffer with 64000 bytes" error while attempting to pass the Input and Output TensorAudio Buffer to TFLite Interpreter for inference HOT 1
- ImportError from image_utils HOT 4
- Could you please provide a aarch64 tflite-support wheel for python 3.10 HOT 2
- YOLOv8 `tensorflow>=2.14.0` ImportError: generic_type: cannot initialize type "StatusCode": an object with that name is already defined HOT 6
- How to read .wav in adroid jni?
- `tf.lite`, or `tflite_tuntime.interpreter as `tflite`?
- TensorFlowLiteTaskAudio for iOS: How to save audio and then play it
- ERROR: Could not find a version that satisfies the requirement tflite-support==0.4.4 HOT 4
- Installation Error: Unable to find installation candidates for tflite-support (0.4.4) HOT 1
- Build TensorFlowLiteTaskVision_framework failed HOT 2
- How to handle dynamic output tensors with `tflite.runForMultipleInputsOutputs`
- iOS Error duplicate symbols HOT 2
- 0.4.2 and 0.4.3 versions of the pod are crashing on app launch on iOS 12.5.7
- Quantization with tflite : Unexpected input data type. Actual: (tensor(float)) , expected: (tensor(int8))
- How to install tflite_support in pip by source compiling HOT 3
- Possibility of channel-by-channel image normalization when adding metadata
- Document TFLite Support vs MediaPipe HOT 2
- No 0.4.4 PyPi package available for Arm/Python 3.11 HOT 1
- Model Loading Error for Image Embedder in Android
- MobileNetV3 quantization
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 tflite-support.