Repository navigation
Add a tf.contrib.image.translate function - #12306
Conversation
|
@ringw, thanks for your PR! By analyzing the history of the files in this pull request, we identified @jart, @tensorflower-gardener and @drpngx to be potential reviewers. |
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
| axis=1) | ||
|
|
||
|
|
||
| def translations_to_projective_transforms(translations): |
There was a problem hiding this comment.
does this need to be public, or can it be an hidden?
There was a problem hiding this comment.
We already expose angles_to_projective_transforms so that users can compose transformation matrices, so my plan was to make similar public methods for any transformation.
vrv
left a comment
There was a problem hiding this comment.
Letting eugene look at the rest of this.
|
Thanks, @ringw! Sorry I haven't gotten a chance to finish off that PR. Lgtm |
|
@sampepose I think you need to sign the CLA before this can be merged. Otherwise it will be stuck forever. :-) |
|
hmm I've signed the CLA, not sure why this isn't going through.
SP
…On Sun, Sep 10, 2017 at 3:05 PM, Andrew Hundt ***@***.***> wrote:
@sampepose <https://github.com/sampepose> I think you need to sign the
CLA before this can be merged. Otherwise it will be stuck forever. :-)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#12306 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABxRu0REWoqPGQVlVshEeWV3gOqQZ_e2ks5shEEZgaJpZM4O4H3z>
.
|
| return output | ||
|
|
||
|
|
||
| def translate(images, translations, interpolation="NEAREST"): |
There was a problem hiding this comment.
name= arg on any function that creates new ops., use it inside a "with name_scope(...):" before creating any ops. here, elsewhere.
There was a problem hiding this comment.
Added name= args and tf.name_scope(name) throughout.
| """ | ||
| translation_or_translations = ops.convert_to_tensor( | ||
| translations, name="translations", dtype=dtypes.float32) | ||
| if len(translation_or_translations.get_shape()) == 1: |
There was a problem hiding this comment.
what if .get_shape() returns TensorShape(None)?
There was a problem hiding this comment.
That is an issue throughout, but it's really useful to do this validation eagerly and be able to return a tensor with the correct shape (HW, HWC, or NHWC). Added docstrings indicating which arguments need a static shape with a known rank.
|
@ahundt @sampepose The googlebot comment says "The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.", so hopefully the CLA is OK? |
Indicate in the docstrings when the static shape of the arguments must have a known rank.
|
Oh I see you're right, I had only looked at the |
|
@ringw we really need that CLA. Could you double check? Usually, it's a problem with the email address, or commits getting co-mingled the PR. Thanks. |
|
@drpngx The only details I see about the CLA are: "The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request." @sampepose confirmed in this pull request that he's OK with contributing his commit. Are there any further steps necessary? Sam's commit has [email protected] which appears to be his email on his profile, and my commits have [email protected]. I don't see any other commits that got co-mingled. |
|
@sampepose Please leave a comment that you're OK with it, and then we can override and merge. However, we need an OK from @ebrevdo first. Thanks. |
|
Sam already replied with "LGTM". |
|
@ringw I saw that, I just want a clear comment. |
|
@drpngx is this okay to merge ? |
|
I think we'd still like an approval from @ebrevdo. Once that is done, @gunan, @martinwicke or @jhseu can override the CLA flag and merge. |
| [24, 19, 14, 9, 4]]]) | ||
|
|
||
| def test_translate(self): | ||
| with self.test_session(): |
There was a problem hiding this comment.
Move the new session inside the loop.
|
|
||
|
|
||
| def rotate(images, angles, interpolation="NEAREST"): | ||
| def rotate(images, angles, interpolation="NEAREST", name="rotate"): |
There was a problem hiding this comment.
name=None and use the default second argument to name_scope below
| image_or_images = ops.convert_to_tensor(images) | ||
| if image_or_images.dtype.base_dtype not in _IMAGE_DTYPES: | ||
| raise TypeError("Invalid dtype %s." % image_or_images.dtype) | ||
| if len(image_or_images.get_shape()) == 2: |
There was a problem hiding this comment.
Check that shape.ndims is not none first
| (num_rows, num_columns) (HW). The rank must be statically known (the | ||
| shape is not `TensorShape(None)`. | ||
| translations: A vector representing [dx, dy] or (if images has rank 4) | ||
| a vector of length num_images, with a [dx, dy] vector for each image in |
| Raises: | ||
| TypeError: If `image` is an invalid type. | ||
| """ | ||
| with ops.name_scope(name): |
| with ops.name_scope(name): | ||
| angle_or_angles = ops.convert_to_tensor( | ||
| angles, name="angles", dtype=dtypes.float32) | ||
| if len(angle_or_angles.get_shape()) == 0: # pylint: disable=g-explicit-length-test |
| else: | ||
| raise TypeError("Translations should have rank 1 or 2.") | ||
| num_translations = array_ops.shape(translations)[0] | ||
| return array_ops.concat( |
There was a problem hiding this comment.
Explain what you're doing here. Match dtype to image dtype?
There was a problem hiding this comment.
Actually, this just processes the translation matrices, which are always float32. Added a comment to clarify this, and describe the translation matrix.
|
Ping @ebrevdo |
|
Sorry for the delay, merged. |
|
No problem! |
Opening as a replacement for #10748. Made a small simplification. @sampepose