[go: nahoru, domu]

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

User defined color in tf.image.resize_with_crop_or_pad #41272

Open
ClementWalter opened this issue Jul 10, 2020 · 0 comments
Open

User defined color in tf.image.resize_with_crop_or_pad #41272

ClementWalter opened this issue Jul 10, 2020 · 0 comments
Assignees
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower type:feature Feature requests

Comments

@ClementWalter
Copy link
ClementWalter commented Jul 10, 2020

Please make sure that this is a feature request. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:feature_template

System information

  • TensorFlow version (you are using): tf 2.2.0
  • Are you willing to contribute it (Yes/No): Yes

Describe the feature and the current behavior/state.

Currently, the tf.image.resize_with_crop_or_pad ops pads with 0. It would be helpful to be able to give another value because in some application black is not the right color for padding (it messes with real data).

Will this change the current api? How?

Adding a kwarg padding_color Union[int, iterable] with:

  • int, a value to be used on all channels (currently 0)
  • iterable: with len(iterable) == number of channel to describe any rgb color

Example of how to achieve the expected result currently:

        output_tensor = tf.image.resize_with_crop_or_pad(input_tensor, 450, 450)
        padding = (1 - tf.image.resize_with_crop_or_pad(tf.ones_like(input_tensor), 450, 450)) * tf.constant(
            [255, 0, 255], dtype=tf.uint8
        )
        output_tensor += padding

Who will benefit with this feature?

Users who need to pad images with another color because black is not suitable for their dataset

Any Other info.

@ClementWalter ClementWalter added the type:feature Feature requests label Jul 10, 2020
@ravikyram ravikyram added the comp:ops OPs related issues label Jul 10, 2020
@jvishnuvardhan jvishnuvardhan added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Nov 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:ops OPs related issues stat:awaiting tensorflower Status - Awaiting response from tensorflower type:feature Feature requests
Projects
None yet
Development

No branches or pull requests

3 participants