简体   繁体   English

如何在 tensorflow 2 中实现随机剪切预处理层?

[英]How can I implement a random shear preprocessing layer in tensorflow 2?

I am looking for a layer that randomly shears a batch of images, such as the preprocessing layers in tf.keras.layers.experimental.preprocessing .我正在寻找一个随机剪切一批图像的层,例如tf.keras.layers.experimental.preprocessing中的预处理层。 However, there doesn't seem to be any such layer.但是,似乎没有任何这样的层。

There are a few similar questions to implementing shear layers in TF, but those use deprecated methods in tf.contrib ( here and here ).在 TF 中实现剪切层有一些类似的问题,但这些问题在tf.contrib中使用了已弃用的方法( 此处此处)。 Can someone point me in a direction to implement random shears in tensorflow 2?有人可以指出我在 tensorflow 2 中实现随机剪切的方向吗?

Few of the operations of tf.contrib in Tensorflow 2.x is moved to Tensorflow addons. Tensorflow 2.x 中 tf.contrib 的一些操作已移至 Tensorflow 插件。 Equivalent for tf.contrib.image.transoform is tfa.image.transform For more details on library find here tf.contrib.image.transoform的等效项是tfa.image.transform有关库的更多详细信息,请参见此处

And also take a look at Random_shear using tf.keras.preprocessing.image.random_shear还可以使用 tf.keras.preprocessing.image.random_shear 查看Random_shear

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM