Tensorflow 1.8 添加了实用程序以应用 变形到图像(参见例如 sparse_image_warp 和 dense_image_warp)。这很好,但我一直无法找到任何实用程序来创建变形。
例如,我可以根据以下条件随机旋转图像:
radians = tf.random_uniform([], -1.0, 1.0)
img = tf.contrib.image.rotate(img, radians)
使图像变形的等效代码是什么?
flow = ... # your code here
img = tf.contrib.image.dense_image_warp(img, flow)
我知道可以通过多种方式生成流,而且我对选择哪种方式并不挑剔,只要它不会撕裂图像设备(例如,我正在寻找 diffeomorphism或至少一个 homeomorphism )。
最佳答案
看来你可能想看看this kaggle page在弹性转换上,它实现了 this article .
这与我的 meshgrid+noise baseline 非常相似,尽管它看起来更加小心,提供的示例表明您可以极大地扰动图像而不会得到完整的垃圾,希望它有所帮助。
编辑:您可以查看 this new library实现不同的图像变换,包括网格失真,这可能为图像变形提供弹性变换的替代方案
关于python - TensorFlow 中的图像变形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51926032/