我有一个32x32x3格式的10.000张图片的张量。因此张量是形状( D4 (10000,32,32,3)。
Tensor("...", shape=(10000, 32, 32, 3), dtype=float32)现在,我想将tf.image.per_image_standardization操作应用于各个图像:
tf. image. per_image_standardization (...)这种情况下的最佳实践是什么?也许把张量分成10000个张量,形状是(32,32,3)?
发布于 2018-01-09 00:28:00
您可以使用tf.map_fn将指定的函数应用于张量的每个元素(从第一维展开):
import tensorflow as tf
a = tf.get_variable("a", (10000,32,32,3))
a = tf.map_fn(lambda x: tf.image.per_image_standardization(x), a, parallel_iterations=10000)
print(a.shape)https://stackoverflow.com/questions/48152124
复制相似问题