Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing Layer #6879

Merged
merged 13 commits into from
Oct 11, 2022
Merged

Commits on Sep 29, 2022

  1. Updating to tfjs master: latest (#41)

    * Update jasmine_util.ts (tensorflow#6872)
    
    FIX
    
    * webgl: Fix NaN issue (tensorflow#6828)
    
    Fix tensorflow#6822
    
    Problem
    1: On some GPUs, even if a and b are both non-NaN, the value of isNaN in vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); are still larger than 0., which misleads all values become NAN.
    2: After resolving NAN issue, the result is still incorrect. It seems that the isnan_custom is not well supported on the problem GPU. After switching back to builtin isnan, everything works well.
    
    Solution:
    Use the bool type bvec4 instead of float type vec4 to calculate isNaN to avoid the the float precision issue when comparing with zero.
    Meanwhile, add an env flag WEBGL2_ISNAN_CUSTOM to allow user to specify which isnan to use.
    
    * Upgrade nodejs to 18.7.0 (tensorflow#6863)
    
    * Upgrade nodejs to 18.7.0
    
    * Fix hash table test string not passed as base64
    
    * fixed prelu fusing code that pre-maturely neg the const on multiply (tensorflow#6876)
    
    Co-authored-by: RajeshT <43972606+rthadur@users.noreply.github.com>
    
    Co-authored-by: Linchenn <40653845+Linchenn@users.noreply.github.com>
    Co-authored-by: Jiajia Qin <jiajia.qin@intel.com>
    Co-authored-by: Matthew Soulanille <msoulanille@google.com>
    Co-authored-by: Ping Yu <4018+pyu10055@users.noreply.github.com>
    Co-authored-by: RajeshT <43972606+rthadur@users.noreply.github.com>
    6 people committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    aa484a6 View commit details
    Browse the repository at this point in the history
  2. Implementation of preprocessing image resizing layer (#42)

    * Implementation of preprocessing image resizing layer
    Important Note:
    The lower-level op implementation of image resizing-nearest neighbor in TensorFlow.js differs from the implementation of the comparable op in Keras-Python.
    
    While the Python version of the op function always selects the bottom right cell of the sub-matrix to be used as the representative value of that region in the downscaled matrix, the JavaScript implementation defaults to the top left cell of the sub-matrix, and then preferentially shifts to the right side of the sub-matrix in all sub-matrices past the lateral halfway point ( calculated by floor((length-1)/2) ), and the bottom side of the sub-matrix in all sub-matrices past the vertical halfway point, when considering the top-left side of the parent matrix as the origin.
    
    This causes a slight variation in the output values from nearest neighbor downscaling between the Python and JavaScript versions of the code as it currently stands, and the unit tests for the resizing layer has been implemented to reflect this difference in op-function behavior.
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    
    * Updating image preprocessing test file to include approved usage of CodeSmith licensing header
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    3 people committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    e830d9f View commit details
    Browse the repository at this point in the history
  3. Updating Resizing to Latest TFJS Master Branch (#43)

    * Update jasmine_util.ts (tensorflow#6872)
    
    FIX
    
    * webgl: Fix NaN issue (tensorflow#6828)
    
    Fix tensorflow#6822
    
    Problem
    1: On some GPUs, even if a and b are both non-NaN, the value of isNaN in vec4 isNaN = min(vec4(isnan(a)) + vec4(isnan(b)), vec4(1.0)); are still larger than 0., which misleads all values become NAN.
    2: After resolving NAN issue, the result is still incorrect. It seems that the isnan_custom is not well supported on the problem GPU. After switching back to builtin isnan, everything works well.
    
    Solution:
    Use the bool type bvec4 instead of float type vec4 to calculate isNaN to avoid the the float precision issue when comparing with zero.
    Meanwhile, add an env flag WEBGL2_ISNAN_CUSTOM to allow user to specify which isnan to use.
    
    * Upgrade nodejs to 18.7.0 (tensorflow#6863)
    
    * Upgrade nodejs to 18.7.0
    
    * Fix hash table test string not passed as base64
    
    * fixed prelu fusing code that pre-maturely neg the const on multiply (tensorflow#6876)
    
    Co-authored-by: RajeshT <43972606+rthadur@users.noreply.github.com>
    
    Co-authored-by: Linchenn <40653845+Linchenn@users.noreply.github.com>
    Co-authored-by: Jiajia Qin <jiajia.qin@intel.com>
    Co-authored-by: Matthew Soulanille <msoulanille@google.com>
    Co-authored-by: Ping Yu <4018+pyu10055@users.noreply.github.com>
    Co-authored-by: RajeshT <43972606+rthadur@users.noreply.github.com>
    6 people committed Sep 29, 2022
    Configuration menu
    Copy the full SHA
    9d09b67 View commit details
    Browse the repository at this point in the history

Commits on Sep 30, 2022

  1. Configuration menu
    Copy the full SHA
    807fedf View commit details
    Browse the repository at this point in the history

Commits on Oct 6, 2022

  1. Refactored interpolation method type declaration (#54)

    * Implementation of preprocessing image resizing layer
    Important Note:
    The lower-level op implementation of image resizing-nearest neighbor in TensorFlow.js differs from the implementation of the comparable op in Keras-Python.
    
    While the Python version of the op function always selects the bottom right cell of the sub-matrix to be used as the representative value of that region in the downscaled matrix, the JavaScript implementation defaults to the top left cell of the sub-matrix, and then preferentially shifts to the right side of the sub-matrix in all sub-matrices past the lateral halfway point ( calculated by floor((length-1)/2) ), and the bottom side of the sub-matrix in all sub-matrices past the vertical halfway point, when considering the top-left side of the parent matrix as the origin.
    
    This causes a slight variation in the output values from nearest neighbor downscaling between the Python and JavaScript versions of the code as it currently stands, and the unit tests for the resizing layer has been implemented to reflect this difference in op-function behavior.
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    
    * Updating image preprocessing test file to include approved usage of CodeSmith licensing header
    
    * refactored interpolation type declaration
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    3 people committed Oct 6, 2022
    Configuration menu
    Copy the full SHA
    066d46a View commit details
    Browse the repository at this point in the history
  2. Minor spacing correction (#55)

    * Implementation of preprocessing image resizing layer
    Important Note:
    The lower-level op implementation of image resizing-nearest neighbor in TensorFlow.js differs from the implementation of the comparable op in Keras-Python.
    
    While the Python version of the op function always selects the bottom right cell of the sub-matrix to be used as the representative value of that region in the downscaled matrix, the JavaScript implementation defaults to the top left cell of the sub-matrix, and then preferentially shifts to the right side of the sub-matrix in all sub-matrices past the lateral halfway point ( calculated by floor((length-1)/2) ), and the bottom side of the sub-matrix in all sub-matrices past the vertical halfway point, when considering the top-left side of the parent matrix as the origin.
    
    This causes a slight variation in the output values from nearest neighbor downscaling between the Python and JavaScript versions of the code as it currently stands, and the unit tests for the resizing layer has been implemented to reflect this difference in op-function behavior.
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    
    * Updating image preprocessing test file to include approved usage of CodeSmith licensing header
    
    * refactored interpolation type declaration
    
    * minor spacing correction
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    3 people committed Oct 6, 2022
    Configuration menu
    Copy the full SHA
    d5d8c17 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    05d0837 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    5e57be4 View commit details
    Browse the repository at this point in the history

Commits on Oct 7, 2022

  1. Configuration menu
    Copy the full SHA
    e90cc76 View commit details
    Browse the repository at this point in the history
  2. Update tfjs-layers/src/layers/preprocessing/image_resizing_test.ts

    Co-authored-by: Matthew Soulanille <matthew@soulanille.net>
    koyykdy and mattsoulanille committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    e16cace View commit details
    Browse the repository at this point in the history
  3. Resizing layer unit test assertion argument casting error refactored (#…

    …57)
    
    * Implementation of preprocessing image resizing layer
    Important Note:
    The lower-level op implementation of image resizing-nearest neighbor in TensorFlow.js differs from the implementation of the comparable op in Keras-Python.
    
    While the Python version of the op function always selects the bottom right cell of the sub-matrix to be used as the representative value of that region in the downscaled matrix, the JavaScript implementation defaults to the top left cell of the sub-matrix, and then preferentially shifts to the right side of the sub-matrix in all sub-matrices past the lateral halfway point ( calculated by floor((length-1)/2) ), and the bottom side of the sub-matrix in all sub-matrices past the vertical halfway point, when considering the top-left side of the parent matrix as the origin.
    
    This causes a slight variation in the output values from nearest neighbor downscaling between the Python and JavaScript versions of the code as it currently stands, and the unit tests for the resizing layer has been implemented to reflect this difference in op-function behavior.
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    
    * Updating image preprocessing test file to include approved usage of CodeSmith licensing header
    
    * refactored interpolation type declaration
    
    * minor spacing correction
    
    * resizing layer test assertion statement argument casting refactored
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    3 people committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    641c3a6 View commit details
    Browse the repository at this point in the history
  4. Resizing layer unit test assertion line length exceeded refactored (#58)

    * Implementation of preprocessing image resizing layer
    Important Note:
    The lower-level op implementation of image resizing-nearest neighbor in TensorFlow.js differs from the implementation of the comparable op in Keras-Python.
    
    While the Python version of the op function always selects the bottom right cell of the sub-matrix to be used as the representative value of that region in the downscaled matrix, the JavaScript implementation defaults to the top left cell of the sub-matrix, and then preferentially shifts to the right side of the sub-matrix in all sub-matrices past the lateral halfway point ( calculated by floor((length-1)/2) ), and the bottom side of the sub-matrix in all sub-matrices past the vertical halfway point, when considering the top-left side of the parent matrix as the origin.
    
    This causes a slight variation in the output values from nearest neighbor downscaling between the Python and JavaScript versions of the code as it currently stands, and the unit tests for the resizing layer has been implemented to reflect this difference in op-function behavior.
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    
    * Updating image preprocessing test file to include approved usage of CodeSmith licensing header
    
    * refactored interpolation type declaration
    
    * minor spacing correction
    
    * resizing layer test assertion statement argument casting refactored
    
    * image resizing layer unit test assertion line max length exceeded refactored
    
    Co-authored-by: Adam Lang (@AdamLang96) <adamglang96@gmail.com>
    Co-authored-by: Brian Zheng (@Brianzheng123) <brianzheng345@gmail.com>
    3 people committed Oct 7, 2022
    Configuration menu
    Copy the full SHA
    c7f7f36 View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2022

  1. Configuration menu
    Copy the full SHA
    d0bdcdb View commit details
    Browse the repository at this point in the history