Việc dự đoán mô hình có siêu dữ liệu có thể dễ dàng
một vài dòng mã. Siêu dữ liệu LiteRT chứa nội dung mô tả phong phú về
chức năng của mô hình và cách sử dụng mô hình. Hộp cát về quyền riêng tư có thể cho phép trình tạo mã
tự động tạo mã suy luận cho bạn, chẳng hạn như sử dụng thông tin
Tính năng liên kết học máy trong Studio hoặc LiteRT
Trình tạo mã Android. Bạn cũng có thể dùng công cụ này để
định cấu hình quy trình suy luận tuỳ chỉnh.
Công cụ và thư viện
LiteRT cung cấp nhiều công cụ và thư viện để phục vụ nhiều loại công cụ
các cấp triển khai như sau:
Tạo giao diện mô hình bằng trình tạo mã Android
Có 2 cách để tự động tạo mã trình bao bọc Android cần thiết
đối với mô hình LiteRT có siêu dữ liệu:
Hiện đã có công cụ Liên kết mô hình học máy của Android Studio
trong Android Studio để nhập mô hình LiteRT thông qua
. Android Studio sẽ tự động định cấu hình chế độ cài đặt cho
dự án và tạo các lớp trình bao bọc dựa trên siêu dữ liệu của mô hình.
Trình tạo mã LiteRT là một tệp thực thi
tự động tạo giao diện mô hình dựa trên siêu dữ liệu. Hiện tại
hỗ trợ Android bằng Java. Mã bao bọc giúp loại bỏ nhu cầu tương tác
trực tiếp với ByteBuffer. Thay vào đó, nhà phát triển có thể tương tác với
Mô hình LiteRT với các đối tượng đã nhập như Bitmap và Rect.
Người dùng Android Studio cũng có thể sử dụng tính năng tạo mã thông qua
Liên kết máy học trong Android Studio
Xây dựng quy trình suy luận tuỳ chỉnh bằng Thư viện hỗ trợ LiteRT
Thư viện hỗ trợ LiteRT là một thư viện đa nền tảng
giúp tuỳ chỉnh giao diện mô hình và xây dựng quy trình suy luận. Nó
chứa nhiều phương pháp sử dụng và cấu trúc dữ liệu để thực hiện trước/sau
xử lý và chuyển đổi dữ liệu. API này cũng được thiết kế để phù hợp với hành vi của
Các mô-đun TensorFlow, chẳng hạn như TF.Image và TF.Text, đảm bảo tính nhất quán từ
khả năng suy luận.
Khám phá các mô hình đã qua huấn luyện bằng siêu dữ liệu
Duyệt qua Các mô hình trong Kaggle để
tải các mô hình huấn luyện trước có siêu dữ liệu cho cả nhiệm vụ liên quan đến tầm nhìn và văn bản. Ngoài ra
bạn có thể xem các tuỳ chọn khác nhau để hình ảnh hoá
siêu dữ liệu.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-24 UTC."],[],[],null,["# LiteRT inference with metadata\n\nInferencing [models with metadata](../../models/metadata) can be as easy as just\na few lines of code. LiteRT metadata contains a rich description of\nwhat the model does and how to use the model. It can empower code generators to\nautomatically generate the inference code for you, such as using the [Android\nStudio ML Binding feature](../metadata/codegen#mlbinding) or [LiteRT\nAndroid code generator](../metadata/codegen#codegen). It can also be used to\nconfigure your custom inference pipeline.\n\nTools and libraries\n-------------------\n\nLiteRT provides varieties of tools and libraries to serve different\ntiers of deployment requirements as follows:\n\n### Generate model interface with Android code generators\n\nThere are two ways to automatically generate the necessary Android wrapper code\nfor LiteRT model with metadata:\n\n1. [Android Studio ML Model Binding](./codegen#mlbinding) is tooling available\n within Android Studio to import LiteRT model through a graphical\n interface. Android Studio will automatically configure settings for the\n project and generate wrapper classes based on the model metadata.\n\n2. [LiteRT Code Generator](./codegen#codegen) is an executable that\n generates model interface automatically based on the metadata. It currently\n supports Android with Java. The wrapper code removes the need to interact\n directly with `ByteBuffer`. Instead, developers can interact with the\n LiteRT model with typed objects such as `Bitmap` and `Rect`.\n Android Studio users can also get access to the codegen feature through\n [Android Studio ML Binding](./codegen#mlbinding).\n\n### Build custom inference pipelines with the LiteRT Support Library\n\n[LiteRT Support Library](./lite_support) is a cross-platform library\nthat helps to customize model interface and build inference pipelines. It\ncontains varieties of util methods and data structures to perform pre/post\nprocessing and data conversion. It is also designed to match the behavior of\nTensorFlow modules, such as TF.Image and TF.Text, ensuring consistency from\ntraining to inferencing.\n\nExplore pretrained models with metadata\n---------------------------------------\n\nBrowse [Kaggle Models](https://www.kaggle.com/models?framework=tfLite) to\ndownload pretrained models with metadata for both vision and text tasks. Also\nsee different options of [visualizing the\nmetadata](../../models/metadata#visualize_the_metadata).\n\nLiteRT Support GitHub repo\n--------------------------\n\nVisit the [LiteRT Support GitHub\nrepo](https://github.com/tensorflow/tflite-support) for more examples and source\ncode."]]