Giter VIP home page Giter VIP logo

Comments (6)

lu-wang-g avatar lu-wang-g commented on July 19, 2024 1

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.

lu-wang-g avatar lu-wang-g commented on July 19, 2024 1

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.

ben-xD avatar ben-xD commented on July 19, 2024

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.

ben-xD avatar ben-xD commented on July 19, 2024

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.

lu-wang-g avatar lu-wang-g commented on July 19, 2024

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.

ben-xD avatar ben-xD commented on July 19, 2024

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 is 19.481830329

from tflite-support.

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.