- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在编写一个将视频映射到文本的序列到序列模型。我在 SequenceExample proto 的序列特征中将视频帧编码为 JPEG 字符串。在构建我的输入管道时,我正在执行以下操作以获取解码后的 jpeg 数组:
encoded_video, caption = parse_sequence_example(
serialized_sequence_example,
video_feature="video/frames",
caption_feature="video/caption_ids")
decoded_video = tf.map_fn(lambda x: tf.image.decode_jpeg(x, channels=3), encoded_video)
InvalidArgumentError (see above for traceback): TensorArray dtype is string but Op is trying to write dtype uint8.
image = tf.image.convert_image_dtype(image, dtype=tf.float32)
解码后得到uint8的像素值在[0,255]之间 float 在[0,1]之间。
decoded_video = tf.map_fn(lambda x: tf.image.decode_jpeg(x, channels=3), encoded_video, dtype=tf.uint8)
converted_video = tf.map_fn(lambda x: tf.image.convert_image_dtype(x, dtype=tf.float32), decoded_video)
最佳答案
没关系。只需在以下行中显式添加 tf.float32 dtype:
converted_video = tf.map_fn(lambda x: tf.image.convert_image_dtype(x, dtype=tf.float32), decoded_video, dtype=tf.float32)
关于tensorflow - 如何在序列特征上应用 tf.map_fn?收到错误 : TensorArray dtype is string but Op is trying to write dtype uint8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43057635/
我有一个字符串张量(名为句子),我想在其中获取其单词的嵌入: sentence = tf.map_fn(lambda x: tf.string_split([x], delimiter=' ').va
我正在尝试在tensorflow中实现多维lstm,我正在使用TensorArray来记住以前的状态,我正在使用一种复杂的方法来获取两个邻居状态(上面和左边)。 tf.cond 希望两个可能的条件都存
我通过 tf.while_loop() 得到一个 TensorArray,其中包含不同形状张量的列表,但我不知道如何将它们作为带有张量的普通列表。 例如: TensorArray([[1,2], [1
我正在研究 map_fn 函数,注意到它输出一个 TensorArray,这应该意味着它能够输出“锯齿状”张量(其中内部的张量具有不同的第一维)。 我试着用这段代码看看这个: import tenso
我正在使用 Tensorflow v1.15。我有以下示例中给出的 TensorArray 的非常基本的实现: import tensorflow as tf an_array = tf.Tensor
下面我有一个 Tensorflow RNN Cell 的实现,旨在模拟本文中 Alex Graves 的算法 ACT:http://arxiv.org/abs/1603.08983 . 在通过 rnn
import tensorflow as tf B = 3 D = 4 T = 5 tf.reset_default_graph() xs = tf.placeholder(shape=[T, B,
我的 TensorFlow 图的输入之一是可变长度数组的列表(例如 [[0, 1, 2], [3, 4], [5, 6, 7, 8])。为了表示这一点,我在图中使用了 TensorArray。 但是,
我正在尝试为 TensorArray 和 while_loop 的组合生成一个非常简单的示例: # 1000 sequence in the length of 100 matrix = tf.pla
我的目的是做CNN(VGG16),然后将每一帧的输出推送到两层lstm。但是,当我尝试使用 sess.run() 时发生错误。这表明该图构建正确。那么我的错误在哪里?这是错误信息。 tensorflo
我不知道如何使用tensorarray。这是代码。这有什么问题? import tensorflow as tf aI=tf.TensorArray(tf.int32, 2) aO=tf.Tensor
我正在编写一个将视频映射到文本的序列到序列模型。我在 SequenceExample proto 的序列特征中将视频帧编码为 JPEG 字符串。在构建我的输入管道时,我正在执行以下操作以获取解码后的
我是一名优秀的程序员,十分优秀!