私はTensorflow/python APIを使用して画像をポーズにマッピングする回帰ネットワークを実装しており、FixedLengthRecordReaderの出力を処理しようとしています。スライシングTensorflow FixedLengthRecordReader値
私はcifar10 exampleを私の目的に合わせて最小限にしようとしています。
cifar10の例では、生のバイトを読み取り、デコードしてから分割します。
result.key, value = reader.read(filename_queue)
# Convert from a string to a vector of uint8 that is record_bytes long.
record_bytes = tf.decode_raw(value, tf.uint8)
# The first bytes represent the label, which we convert from uint8->int32.
result.label = tf.cast(
tf.slice(record_bytes, [0], [label_bytes]), tf.int32)
# The remaining bytes after the label represent the image, which we reshape
# from [depth * height * width] to [depth, height, width].
depth_major = tf.reshape(tf.slice(record_bytes, [label_bytes], [image_bytes]),
[result.depth, result.height, result.width])
# Convert from [depth, height, width] to [height, width, depth].
result.uint8image = tf.transpose(depth_major, [1, 2, 0])
私は(pose_data、image_data)として保存されたデータを持つバイナリファイルのリストから読んでいます。私のポーズデータはfloat32であり、画像データはuint8なので、まずスライスしてからキャストしたいと思います。残念ながら、reader.readの値の結果は0次元のテンソルのテンソルであるため、スライスは機能しません。
key, value = reader.read(filename_queue)
print value.dtype
print value.get_shape()
<dtype: 'string'>
()
tf.decode_raw(値、DTYPE)の結果は、1次元配列であるが、指定するDTYPEを必要とし、tf.stringは、それが取る有効なタイプではありません。
デコードする前にスライスすることはできますか?または、私はデコードする必要がありますか?>大文字小文字の逆順 - >スライス - >再作成?全く別の方法がありますか?
リンクが壊れている場合は、ここに貼り付けることができる場合は例を参照してください。 – Bastiaan