[英]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_box
和tf.image.pad_to_bounding_box
,因为这两个函数的行为实际上可以分别通过tf.slice
和tf.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_box
和pad_to_bounding_box
都在下面使用了slice
和pad
,但是还添加了检查和约束,以确保您无需花费数小时来尝试调试slice / pad的索引和偏移量。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.