Export the keras.preprocessing.image.smart_resize utility.
PiperOrigin-RevId: 310947004 Change-Id: I518259ac4e88bd82301dc9aeccd868aca8a83e11
This commit is contained in:
parent
4da3e08cd5
commit
f4de924576
@ -49,6 +49,7 @@ random_brightness = image.random_brightness
|
|||||||
apply_affine_transform = image.apply_affine_transform
|
apply_affine_transform = image.apply_affine_transform
|
||||||
|
|
||||||
|
|
||||||
|
@keras_export('keras.preprocessing.image.smart_resize', v1=[])
|
||||||
def smart_resize(x, size, interpolation='bilinear'):
|
def smart_resize(x, size, interpolation='bilinear'):
|
||||||
"""Resize images to a target size without aspect ratio distortion.
|
"""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
|
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).
|
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`
|
Note that passing the argument `preserve_aspect_ratio=True` to `resize`
|
||||||
|
|||||||
@ -68,4 +68,8 @@ tf_module {
|
|||||||
name: "save_img"
|
name: "save_img"
|
||||||
argspec: "args=[\'path\', \'x\', \'data_format\', \'file_format\', \'scale\'], varargs=None, keywords=kwargs, defaults=[\'None\', \'None\', \'True\'], "
|
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\'], "
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user