تعمل مكتبة TensorFlow Lite الطراز على تبسيط عملية تدريب
نموذج TensorFlow Lite باستخدام مجموعة بيانات مخصّصة. وتستخدم التعلم الآلي لتقليل
مقدار بيانات التدريب المطلوبة وتقصير وقت التدريب.
المهام المتاحة
تتوافق مكتبة "مصمم النماذج" حاليًا مع مهام تعلُّم الآلة التالية. انقر على
أدناه للحصول على أدلة حول كيفية تدريب النموذج.
إذا لم تكن المهام لديك، يُرجى استخدام هذه الميزة أولاً
TensorFlow لإعادة تدريب نموذج TensorFlow
مع التعلم الانتقالي (عبر اتباع أدلة مثل
الصورالنص،
الصوت) أو
تدريبه من البداية ثم تحويله إلى TensorFlow
نموذج بسيط
مثال شامل
يسمح لك مصمم النماذج بتدريب نموذج TensorFlow Lite باستخدام مجموعات البيانات المخصصة في
فقط بضعة أسطر من التعليمات البرمجية. على سبيل المثال، إليك خطوات تدريب صورة
نموذج التصنيف.
fromtflite_model_makerimportimage_classifierfromtflite_model_maker.image_classifierimportDataLoader# 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/')
تاريخ التعديل الأخير: 2025-01-14 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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"]],["تاريخ التعديل الأخير: 2025-01-14 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# TensorFlow Lite Model Maker\n\nOverview\n--------\n\nThe TensorFlow Lite Model Maker library simplifies the process of training a\nTensorFlow Lite model using custom dataset. It uses transfer learning to reduce\nthe amount of training data required and shorten the training time.\n\nSupported Tasks\n---------------\n\nThe Model Maker library currently supports the following ML tasks. Click the\nlinks below for guides on how to train the model.\n\n| Supported Tasks | Task Utility |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|\n| Image Classification: [tutorial](./image_classification), [api](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker/image_classifier) | Classify images into predefined categories. |\n| Object Detection: [tutorial](./object_detection), [api](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker/object_detector) | Detect objects in real time. |\n| Text Classification: [tutorial](./text_classification), [api](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker/text_classifier) | Classify text into predefined categories. |\n| BERT Question Answer: [tutorial](./question_answer), [api](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker/question_answer) | Find the answer in a certain context for a given question with BERT. |\n| Audio Classification: [tutorial](./audio_classification), [api](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker/audio_classifier) | Classify audio into predefined categories. |\n| Recommendation: [demo](https://github.com/tensorflow/examples/blob/master/tensorflow_examples/lite/model_maker/demo/recommendation_demo.py), [api](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker/recommendation) | Recommend items based on the context information for on-device scenario. |\n| Searcher: [tutorial](./text_searcher), [api](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker/searcher) | Search for similar text or image in a database. |\n\nIf your tasks are not supported, please first use\n[TensorFlow](https://www.tensorflow.org/guide) to retrain a TensorFlow model\nwith transfer learning (following guides like\n[images](https://www.tensorflow.org/tutorials/images/transfer_learning),\n[text](https://www.tensorflow.org/official_models/fine_tuning_bert),\n[audio](https://www.tensorflow.org/tutorials/audio/transfer_learning_audio)) or\ntrain it from scratch, and then [convert](../../models/convert) it to TensorFlow\nLite model.\n\nEnd-to-End Example\n------------------\n\nModel Maker allows you to train a TensorFlow Lite model using custom datasets in\njust a few lines of code. For example, here are the steps to train an image\nclassification model. \n\n from tflite_model_maker import image_classifier\n from tflite_model_maker.image_classifier import DataLoader\n\n # Load input data specific to an on-device ML app.\n data = DataLoader.from_folder('flower_photos/')\n train_data, test_data = data.split(0.9)\n\n # Customize the TensorFlow model.\n model = image_classifier.create(train_data)\n\n # Evaluate the model.\n loss, accuracy = model.evaluate(test_data)\n\n # Export to Tensorflow Lite model and label file in `export_dir`.\n model.export(export_dir='/tmp/')\n\nFor more details, see the [image classification guide](./image_classification).\n\nInstallation\n------------\n\nThere are two ways to install Model Maker.\n\n- Install a prebuilt pip package.\n\n pip install tflite-model-maker\n\nIf you want to install nightly version, please follow the command: \n\n pip install tflite-model-maker-nightly\n\n- Clone the source code from GitHub and install.\n\n git clone https://github.com/tensorflow/examples\n cd examples/tensorflow_examples/lite/model_maker/pip_package\n pip install -e .\n\nTensorFlow Lite Model Maker depends on TensorFlow [pip\npackage](https://www.tensorflow.org/install/pip). For GPU drivers, please refer\nto TensorFlow's [GPU guide](https://www.tensorflow.org/install/gpu) or\n[installation guide](https://www.tensorflow.org/install).\n\nPython API Reference\n--------------------\n\nYou can find out Model Maker's public APIs in [API\nreference](https://www.tensorflow.org/lite/api_docs/python/tflite_model_maker)."]]