Export the keras.preprocessing.image.smart_resize utility.

PiperOrigin-RevId: 310947004
Change-Id: I518259ac4e88bd82301dc9aeccd868aca8a83e11
This commit is contained in:
Francois Chollet 2020-05-11 10:53:05 -07:00 committed by TensorFlower Gardener
parent 4da3e08cd5
commit f4de924576
2 changed files with 6 additions and 1 deletions

View File

@ -49,6 +49,7 @@ random_brightness = image.random_brightness
apply_affine_transform = image.apply_affine_transform
@keras_export('keras.preprocessing.image.smart_resize', v1=[])
def smart_resize(x, size, interpolation='bilinear'):
"""Resize images to a target size without aspect ratio distortion.
@ -65,7 +66,7 @@ def smart_resize(x, size, interpolation='bilinear'):
```
However, if you do this, you distort the aspect ratio of your images, since
in general they do not all have the same aspect ratio. This is
in general they do not all have the same aspect ratio as `size`. This is
fine in many cases, but not always (e.g. for GANs this can be a problem).
Note that passing the argument `preserve_aspect_ratio=True` to `resize`

View File

@ -68,4 +68,8 @@ tf_module {
name: "save_img"
argspec: "args=[\'path\', \'x\', \'data_format\', \'file_format\', \'scale\'], varargs=None, keywords=kwargs, defaults=[\'None\', \'None\', \'True\'], "
}
member_method {
name: "smart_resize"
argspec: "args=[\'x\', \'size\', \'interpolation\'], varargs=None, keywords=None, defaults=[\'bilinear\'], "
}
}