ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • tf.record
    카테고리 없음 2022. 1. 5. 11:32

    The tf.data API enables you to build complex input pipelines from simple, reusable pieces. For example, the pipeline for an image model might aggregate data from files in a distributed file system, apply random perturbations to each image, and merge randomly selected images into a batch for training. The pipeline for a text model might involve extracting symbols from raw text data, converting them to embedding identifiers with a lookup table, and batching together sequences of different lengths. The tf.data API makes it possible to handle large amounts of data, read from different data formats, and perform complex transformations.

    The tf.data API introduces a tf.data.Dataset abstraction that represents a sequence of elements, in which each element consists of one or more components. For example, in an image pipeline, an element might be a single training example, with a pair of tensor components representing the image and its label.

    There are two distinct ways to create a dataset:

    • A data source constructs a Dataset from data stored in memory or in one or more files.
    • A data transformation constructs a dataset from one or more tf.data.Dataset objects.
     
    tf.data API는 간단하고 재사용가능한 조각으로 이뤄진 복잡한 입력 파이프라인을 만들 수 있도록 한다. 예를 들어, 이미지 모델의 파이프라인은 분산 파일 시스템에 있는 데이터를 모으고, 각 이미지에 무작위 변환(perturbations)을 주고, 학습을 위해 배치 단위로 이미지를 무작위로 선택할 것이다. 텍스트 모델의 파이프라인은 원천 텍스트 데이터에서 심볼을 추출하고, 룩업 테이블을 이용해 임베딩 식별자(identifiers)로 바꾸고, 다른 길이를 가진 시퀀스를 배치할 것이다. tf.data API는 많은 양의 데이터를 다루고, 다른 포맷의 데이터를 읽고, 복잡한 변환을 수행하도록 한다.
    tf.data API는 각 요소가 하나 이상의 구성 요소로 이뤄진 일련의 요소를 나타내는 tf.data.Dataset의 추상화로 나타난다. 예를 들어, 이미지 파이프라인에선, 요소는 이미지와 레이블로 이뤄진 텐서 요소 쌍이 있는 단일 학습 예시 일 수 있다.
    dataset을 만드는덴 2가지 방법이 있다.
    • 메모리나 하나 이상의 파일에 저장된 데이터에서 Dataset를 구성하는 data source
    • 하나 이상의 tf.dataDataset 객체로 부터 dataset을 구성하는 data transformation

     

    기본 메커니즘

    입력 파이프라인을 만들기 위해선, 반드시 data source로 시작해야 한다. 예를 들어, 메모리에 있는 데이터로부터 Dataset를 구성하기 위해선, tf.data.Dataset.from_tensors()tf.data.Dataset.from_tensor_slices()를 사용할 수 있다. TFRecord 형태로 저장된 입력 데이터에선, tf.data.TFRecordDataset()을 이용할 수 있다. 

    Dataset 객체를 갖고 있다면, tf.data.Dataset 객체에 대한 메소드 호출을 연결하여 새 Dataset으로 transform 할 수 있다.

     

    https://www.tensorflow.org/guide/data

     

    tf.data: TensorFlow 입력 파이프라인 빌드  |  TensorFlow Core

    도움말 Kaggle에 TensorFlow과 그레이트 배리어 리프 (Great Barrier Reef)를 보호하기 도전에 참여 tf.data: TensorFlow 입력 파이프라인 빌드 tf.data API를 사용하면 간단하고 재사용 가능한 조각으로 복잡한 입

    www.tensorflow.org

     

     

    댓글

Designed by Tistory.