Skip to content

Conversation

@lina128
Copy link
Collaborator

@lina128 lina128 commented Mar 2, 2021

Add tf addon equivalent image.transform to tfjs (https://www.tensorflow.org/addons/api_docs/python/tfa/image/transform). Helpful for many image processing tasks. This PR only implemented for the cpu and webgl backend.


This change is Reviewable

Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this would be very useful for image processing pipeline.

Reviewable status: 0 of 1 approvals obtained (waiting on @lina128)


tfjs-backend-cpu/src/kernels/Transform.ts, line 226 at r1 (raw file):

  // f(x, yFloor) = (xCeil - x) / (xCeil - xFloor) * f(xFloor, yFloor)
  //               + (x - xFloor) / (xCeil - xFloor) * f(xCeil, yFloor)
  const valueYFloor =

good to name it valueXYFloor and valueXYCeil, since it is interpolating for x


tfjs-core/src/ops/image/transform.ts, line 32 at r1 (raw file):

 *
 * @param image 4d tensor of shape `[batch, imageHeight, imageWidth, depth]`.
 * @param transforms Projective transform matrix/matrices. A vector of length

we don't use the term vector, probably call it tensor1d ?


tfjs-core/src/ops/image/transform_test.ts, line 21 at r1 (raw file):

import {expectArraysClose} from '../../test_util';

describeWithFlags('image.transform', BROWSER_ENVS, () => {

it would be good to add test for different fill and interpolation modes

Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 11 of 11 files at r1.
Reviewable status: 0 of 1 approvals obtained (waiting on @lina128)

Copy link
Collaborator

@pyu10055 pyu10055 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 2 files at r2.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @lina128)

@lina128 lina128 merged commit ed1b9ae into tensorflow:master Mar 9, 2021
@lina128 lina128 deleted the transform branch March 9, 2021 06:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants