Giter Site home page Giter Site logo

Comments (10)

taehoonlee avatar taehoonlee commented on May 14, 2024 1

@whatdhack, The mode of preprocess_input is not related to the backend. It stands for the library used in the original repository (e.g., VGG: caffe).

from keras-applications.

taehoonlee avatar taehoonlee commented on May 14, 2024 1

@whatdhack, The mode of preprocess_input is originated from each model's original repository:

  • caffe: 'RGB'->'BGR' followed by x -= [103.939, 116.779, 123.68] (e.g., VGG16 and VGG19),
  • tf: x /= 127.5 followed by x -= 1 (e.g., InceptionV3 and InceptionResNetV2),
  • torch: x /= 255. followed by x -= [0.485, 0.456, 0.406] and x /= [0.229, 0.224, 0.225] (e.g., DenseNet121 and DenseNet169).

If you are trying to deploy the pretrained networks, it is not an option to modify the mode designated for each model. Otherwise, you can choose another mode but it is not so recommended.

from keras-applications.

taehoonlee avatar taehoonlee commented on May 14, 2024 1

@whatdhack, It doesn't need to be documented because end-users will not directly call imagenet_utils.preprocess_input. And, the mode of preprocess_input is about only normalization and orthogonal to the backend (i.e., caffe mode works on all the backends).

from keras-applications.

whatdhack avatar whatdhack commented on May 14, 2024

@taehoonlee , that is a good start. Can put more details in your answers. Your answers are cryptic ( and incomplete) . Looks like you are closing these issues for the sake of closing.

from keras-applications.

whatdhack avatar whatdhack commented on May 14, 2024

@taehoonlee , for the pre-trained models (e.g. VGG16) , it needs to be documented what modes are applicable. otherwise it takes time to run experiments and figure out what modes are available. For VGG16 it looks like, the pre-trained model can only handle 'caffe' mode.

A related question is the support across different backend uniform (i.e. does the 'caffe' mode work across TF, PyTorch , CNTK , etc . ) ?

from keras-applications.

whatdhack avatar whatdhack commented on May 14, 2024

@taehoonlee Really ? All the Keras applications examples use preprocess_input . See for yourself - vgg16

from keras-applications.

taehoonlee avatar taehoonlee commented on May 14, 2024

@whatdhack, Users will use a wrapper function preprocess_input(x) rather than a imagenet_utils.preprocess_input(x, data_format, mode). The example also presents x = preprocess_input(x).

from keras-applications.

whatdhack avatar whatdhack commented on May 14, 2024

@taehoonlee , I am not sure I can take your word on this one as you did not even know usage of process_input() before I pointed that out. Documentation on preprocess_input() will clarify the confusion.

from keras-applications.

taehoonlee avatar taehoonlee commented on May 14, 2024

:)

from keras-applications.

itsnamgyu avatar itsnamgyu commented on May 14, 2024

Seems legit, but the naming is awfully confusing for someone looking into the code (for exploration or debugging purposes)

@whatdhack, The mode of preprocess_input is originated from each model's original repository:

  • caffe: 'RGB'->'BGR' followed by x -= [103.939, 116.779, 123.68] (e.g., VGG16 and VGG19),
  • tf: x /= 127.5 followed by x -= 1 (e.g., InceptionV3 and InceptionResNetV2),
  • torch: x /= 255. followed by x -= [0.485, 0.456, 0.406] and x /= [0.229, 0.224, 0.225] (e.g., DenseNet121 and DenseNet169).

If you are trying to deploy the pretrained networks, it is not an option to modify the mode designated for each model. Otherwise, you can choose another mode but it is not so recommended.

from keras-applications.

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.