Giter VIP home page Giter VIP logo

Comments (4)

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

As you've noticed, Codegen does support per channel normalization through metadata, same as TFLite Task library .

The comments have been updated. See here. Let me know if it makes sense to you.

from tflite-support.

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

Yes, I don't think tf.image support per channel normalization. Usually this is done simply by

VGG_MEAN = [123.68, 116.78, 103.94]
input_img_norm = (input_img - tf.constant(VGG_MEAN)) / 255.0

What does it mean: "except that the input is a UINT8 Tensor?

It means if the input tensor is UINT8, and if mean is 0 and stddev is 1, the returned TensorBuffer will not be a FLOAT32 tensor, but a UINT8 tensor, because the original input tensor is returned.

I'll update the comment shortly.

from tflite-support.

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

It looks like the codegen which uses support library already does this. After adding the appropriate metadata using Python, the relevant codegen is:

.add(new NormalizeOp(metadata.getImageMean(), metadata.getImageStddev()));

where the generated class Metadata contains

        public float[] getImageMean() {
            return Arrays.copyOf(imageMean, imageMean.length);
        }

I will leave it open for you to update the comment? Thanks for your reply.

from tflite-support.

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

Closing the issue. Feel free to reopen it if you have other questions.

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.