【Tensorflow] TFRecord読み取りと書き込み機構

  1. 読み取りが行の各バッチに読み出される場合に書き込みが、行ごとに書かれているtfrecord、。

  2. forループ(例えば:img_path、cls_label = img_paths [Iによる書き込み、 ]、cls_labels [I]) 内部tf.train.Example送り機能に。
    したがって、機能tf.train.Exampleは(img_path、その対応encode_img、cls_label、pts_label含む)単一のデータラインに供給しました。

    example = tf.train.Example(features=tf.train.Features(feature={
        'img_path': _bytes_feature(img_path),
        'encoded': _bytes_feature(image_buffer),
        'cls_label': _int64_feature(cls_label)
    }))
    

    あなたはできるprint(example)、それを表示します。

  3. 最終的なデータは、内tfrecordの2次元リストを形成します。

    [ { [img_path], [img_encode], [cls_label], [pts_label] }
      { [img_path], [img_encode], [cls_label], [pts_label] }
      { [img_path], [img_encode], [cls_label], [pts_label] }
      { [img_path], [img_encode], [cls_label], [pts_label] }
                                                 … …
      { [img_path], [img_encode], [cls_label], [pts_label] } ]
    

    リスト内の各行は、ある完全なデータ要素、要素= {[img_path]、[img_encode]、[cls_label]、[pts_label]}

  4. 具体的には、要素= {[B '\ img_1.jpgに\パス\']、[\ DF \ SDF \ DF \ DF \ dfsxc \ D]、[1]、[21.2、34.6、45.1、56.7]}

  5. すべての個人がタイプリストの要素、書き込み_int64_feature、_float_feature、_bytes_featureであり、それは一次元のリストでなければなりません!

公開された628元の記事 ウォンの賞賛863 ビュー185万+

おすすめ

転載: blog.csdn.net/JNingWei/article/details/104879886