コンバータのコマンドラインリファレンス
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このページでは、TensorFlow 2.0 でコマンドラインから TensorFlow Lite コンバータ を使用する方法を説明します。 ただし、より好ましいのは Python API を使用する方法です。
概要の概要
TensorFlow Lite コンバータには基本的なモデルをサポートするコマンドラインツール tflite_convert
がありますが、量子化やその他のパラメータ (SavedModel のシグネチャや Keras モデルのカスタムオブジェクトなど) を含む場合には、 TFLiteConverter
Python API を使用してください。
使い方
以下のフラグで入力ファイルと出力ファイルを指定します。
--output_file
文字列型。 出力ファイルのパスを指定する。
--saved_model_dir
文字列型。 TensorFlow 1.x もしくは 2.0 で構築した SavedModel を含むディレクトリのパスを指定する。
--keras_model_file
文字列型。 TensorFlow 1.x もしくは 2.0 で構築した tf.keras モデルを含む HDF5ファイルのパスを指定する。
使用例は以下のとおりです。
tflite_convert \
--saved_model_dir=/tmp/mobilenet_saved_model \
--output_file=/tmp/mobilenet.tflite
追加の説明
ソースからビルドする
TensorFlow Lite Converter の最新バージョンを利用するには pip を使用してナイトリービルドをインストールする方法に加えて、TensorFlow リポジトリを clone して bazel
を使う方法があります。
使用例は以下のとおりです。
bazel run //third_party/tensorflow/lite/python:tflite_convert -- \
--saved_model_dir=/tmp/mobilenet_saved_model \
--output_file=/tmp/mobilenet.tflite
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2022-08-09 UTC。
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"必要な情報がない"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"複雑すぎる / 手順が多すぎる"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"最新ではない"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻訳に関する問題"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"サンプル / コードに問題がある"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"その他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"わかりやすい"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"問題の解決に役立った"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"その他"
}]
{"lastModified": "\u6700\u7d42\u66f4\u65b0\u65e5 2022-08-09 UTC\u3002"}
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2022-08-09 UTC。"]]