TensorFlow Lite Model Maker

개요

TensorFlow Lite Model Maker 라이브러리는 모델 학습 프로세스를 커스텀 데이터 세트를 사용하는 TensorFlow Lite 모델 전이 학습을 사용하여 학습 데이터 양을 줄이고 학습 시간을 단축할 수 있습니다.

지원되는 작업

Model Maker 라이브러리는 현재 다음과 같은 ML 태스크를 지원합니다. 그런 다음 모델 학습 방법에 대한 가이드를 보려면 아래 링크를 클릭하세요.

지원되는 작업 작업 유틸리티
이미지 분류: tutorial, api 이미지를 사전 정의된 카테고리로 분류합니다.
객체 감지: 튜토리얼, API 실시간으로 객체 감지
텍스트 분류: tutorial, api 텍스트를 사전 정의된 카테고리로 분류합니다.
BERT 질문 답변: tutorial, api BERT를 사용하여 주어진 질문에 대한 특정 컨텍스트에서 답을 찾습니다.
오디오 분류: tutorial, api 오디오를 사전 정의된 카테고리로 분류합니다.
권장사항: demo, api 기기 내 시나리오의 컨텍스트 정보를 기반으로 항목을 추천합니다.
Searcher: tutorial, api 데이터베이스에서 유사한 텍스트 또는 이미지를 검색합니다.

할 일이 지원되지 않는 경우 먼저 다음을 사용하세요. TensorFlow 모델을 재학습하기 위한 TensorFlow 전이 학습 (예: 이미지 텍스트, 오디오) 또는 모델을 처음부터 학습시킨 다음 TensorFlow로 변환 라이트 모델입니다.

엔드 투 엔드 예

Model Maker를 사용하면 커스텀 데이터 세트를 사용하여 TensorFlow Lite 모델을 코드 몇 줄이면 됩니다. 예를 들어 이미지를 학습하는 단계는 다음과 같습니다. 분류 모델입니다.

from tflite_model_maker import image_classifier
from tflite_model_maker.image_classifier import DataLoader

# Load input data specific to an on-device ML app.
data = DataLoader.from_folder('flower_photos/')
train_data, test_data = data.split(0.9)

# Customize the TensorFlow model.
model = image_classifier.create(train_data)

# Evaluate the model.
loss, accuracy = model.evaluate(test_data)

# Export to Tensorflow Lite model and label file in `export_dir`.
model.export(export_dir='/tmp/')

자세한 내용은 이미지 분류 가이드를 참고하세요.

설치

Model Maker를 설치하는 방법에는 두 가지가 있습니다.

  • 사전 빌드된 pip 패키지를 설치합니다.
pip install tflite-model-maker

나이틀리 버전을 설치하려면 다음 명령어를 따르세요.

pip install tflite-model-maker-nightly
  • GitHub에서 소스 코드를 클론하고 설치합니다.
git clone https://github.com/tensorflow/examples
cd examples/tensorflow_examples/lite/model_maker/pip_package
pip install -e .

TensorFlow Lite Model Maker가 TensorFlow pip에 의존함 패키지를 참고하세요. GPU 드라이버의 경우 TensorFlow의 GPU 가이드 또는 설치 가이드를 참고하세요.

Python API 참조

Model Maker의 공개 API는 API 참조