简体   繁体   English

tf.image.pad_to_bounding_box VS tf.pad和tf.image.crop_to_bounding_box VS tf.slice

[英]tf.image.pad_to_bounding_box VS tf.pad and tf.image.crop_to_bounding_box VS tf.slice

I'd like to understand why does the two functions tf.image.crop_to_bounding_box and tf.image.pad_to_bounding_box exists, since the behaviour of these two functions can be done really simply with respectively tf.slice and tf.pad . 我想了解为什么存在两个函数tf.image.crop_to_bounding_boxtf.image.pad_to_bounding_box ,因为这两个函数的行为实际上可以分别通过tf.slicetf.pad来完成。

They are not so much easier to understand, and their scope is narrow since they accept only 3D and 4D tensors. 它们并不是那么容易理解,并且它们的范围很窄,因为它们仅接受3D和4D张量。 Furthermore, they tend to be slower in terms of time of execution. 此外,它们往往在执行时间方面较慢。

Is there something I miss here ? 我有什么想念的吗?

Mostly you use them tf.image.* for easiness of use. 通常,您使用它们tf.image.*为了易于使用。

Both crop_to_bounding_box and pad_to_bounding_box use slice and pad underneath, but also add checkings and constraints to make sure you don't spend hours trying to debug your slice/pad indices and offsets. crop_to_bounding_boxpad_to_bounding_box都在下面使用了slicepad ,但是还添加了检查和约束,以确保您无需花费数小时来尝试调试slice / pad的索引和偏移量。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 应用tf.image.crop_to_bounding_box和tf.image.encode_jpeg后,图像变为蓝色蒙版 - Image becomes blue masked after applying tf.image.crop_to_bounding_box and tf.image.encode_jpeg tensorflow tf.pad的输出形状 - tensorflow tf.pad shape of output 为什么使用tf.image.sample_distorted_bounding_box边界框和裁剪的图片不匹配? - Why does not the bounding box and clipped picture match using tf.image.sample_distorted_bounding_box? 如何在没有批量大小轴的情况下使用 tf.pad? - How to use tf.pad without batch size axis? tf.pad 返回填充为零的数组,MNIST 数据集填充从 (28,28) 图像大小到 (32,32) - tf.pad returns array filled with zero, MNIST dataset padding from (28,28) image size to (32,32) Tensorflow tf.image.resize_image_with_crop_or_pad用于3D图像 - Tensorflow tf.image.resize_image_with_crop_or_pad For 3D Images tf2.0:tf.image.resize_with_pad 失败,“使用 `tf.Tensor` 作为 Python `bool” 和 tf.keras.Input - tf2.0: tf.image.resize_with_pad fails with “using a `tf.Tensor` as a Python `bool” with tf.keras.Input 使用 `tf.image.resize_image_with_crop_or_pad` 来调整 numpy 数组的大小 - Use `tf.image.resize_image_with_crop_or_pad` to resize numpy array 将tf.split或tf.slice用于keras层 - Using tf.split or tf.slice for keras layers tf.data 与 tf.keras.preprocessing.image.ImageDataGenerator - tf.data vs tf.keras.preprocessing.image.ImageDataGenerator
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM