utils 模块

模型的实用程序 - 大多与预处理相关。

函数

preprocess_array

创建一个采用图像字节数组并返回正则化图像的 tensorflow 操作。

preprocess_array(in_images, order='RGB', scaling_factor=1.0, output_height=224, output_width=224, preserve_aspect_ratio=True)

参数

in_images
必需

图像字节的 [?] 维张量。 (通常为占位符)

order
默认值: RGB

通道顺序 -“BGR”或“RGB”

scaling_factor
默认值: 1.0

通道值的乘数

output_height
默认值: 224

输出图像高度

output_width
默认值: 224

输出图像宽度

preserve_aspect_ratio
默认值: True

如果为 True,则在缩放时保留图像纵横比

返回

图像的 float32 像素值的 [?, output_height, output_width, 3] 维张量。