tf.image.resize_images.md 1.1 KB
Newer Older
J
jiangjiajun 已提交
1 2
## tf.image.resize_images

J
jiangjiajun 已提交
3
### [tf.image.resize_images](https://www.tensorflow.org/versions/r1.13/api_docs/python/tf/image/resize_images)
J
jiangjiajun 已提交
4 5 6 7 8 9 10 11 12 13
``` python
tf.image.resize_images(
    images,
    size,
    method=ResizeMethod.BILINEAR,
    align_corners=False,
    preserve_aspect_ratio=False
)
```

J
jiangjiajun 已提交
14
### [paddle.fluid.layers.image_resize](http://paddlepaddle.org/documentation/docs/zh/1.4/api_cn/layers_cn.html#paddle.fluid.layers.image_resize)
J
jiangjiajun 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
``` python
paddle.fluid.layers.image_resize(
    input, 
    out_shape=None, 
    scale=None, 
    name=None, 
    resample='BILINEAR', 
    actual_shape=None, 
    align_corners=True, 
    align_mode=1
)
```

### 功能差异
#### 参数种类
TensorFlow:支持`BILINEAR`,`NEAREST`,`BICUBIC`, `AREA`四种方式;  
PaddlePaddle:支持`BILINEAR``NEAREST`两种方式, `align_mode``BILINEAR`的可选项,当为1的时候,与TensorFlow功能一致。

### 代码示例
```python
# 输入图像数据shape为[None, 3, 300, 300]
inputs = fluid.layers.data(dtype='float32', shape=[3, 300, 300], name='inputs')

# 输出shape为[3, 400, 500]
outputs = fluid.layers.image_reisze(inputs, [400, 500])
J
jiangjiajun 已提交
40
```