LiteRT برای میکروکنترلرها برای اجرای مدل های یادگیری ماشین بر روی میکروکنترلرها و سایر دستگاه ها با تنها چند کیلوبایت حافظه طراحی شده است. زمان اجرا هسته فقط در 16 کیلوبایت در Arm Cortex M3 قرار می گیرد و می تواند بسیاری از مدل های پایه را اجرا کند. نیازی به پشتیبانی سیستم عامل، کتابخانه های استاندارد C یا C++ یا تخصیص حافظه پویا ندارد.
چرا میکروکنترلرها مهم هستند
میکروکنترلرها معمولاً دستگاههای محاسباتی کوچک و کم مصرفی هستند که در سختافزاری تعبیه شدهاند که به محاسبات اولیه نیاز دارد. با آوردن یادگیری ماشین به میکروکنترلرهای کوچک، میتوانیم هوش میلیاردها دستگاهی را که در زندگیمان استفاده میکنیم، از جمله لوازم خانگی و دستگاههای اینترنت اشیا، بدون تکیه بر سختافزار گرانقیمت یا اتصالات اینترنتی قابل اعتماد، که اغلب در معرض پهنای باند و اینترنت اشیا هستند، افزایش دهیم. محدودیت های قدرت و منجر به تاخیر بالا می شود. این همچنین می تواند به حفظ حریم خصوصی کمک کند، زیرا هیچ داده ای از دستگاه خارج نمی شود. وسایل هوشمندی را تصور کنید که میتوانند با کارهای روزمره شما سازگار شوند، حسگرهای صنعتی هوشمند که تفاوت بین مشکلات و عملکرد عادی را درک میکنند، و اسباببازیهای جادویی که میتوانند به کودکان کمک کنند تا به روشهای سرگرمکننده و لذتبخش یاد بگیرند.
پلتفرم های پشتیبانی شده
LiteRT برای میکروکنترلرها در C++ 17 نوشته شده است و به یک پلتفرم 32 بیتی نیاز دارد. این به طور گسترده با بسیاری از پردازنده های مبتنی بر معماری Arm Cortex-M سری آزمایش شده است و به معماری های دیگر از جمله ESP32 منتقل شده است. این فریم ورک به صورت کتابخانه آردوینو در دسترس است. همچنین می تواند پروژه هایی را برای محیط های توسعه مانند Mbed ایجاد کند. منبع باز است و می تواند در هر پروژه C++ 17 گنجانده شود.
هر برنامه نمونه در GitHub است و دارای یک فایل README.md است که توضیح می دهد چگونه می توان آن را در پلتفرم های پشتیبانی شده خود مستقر کرد. برخی از نمونه ها همچنین دارای آموزش های سرتاسری با استفاده از یک پلتفرم خاص هستند که در زیر آورده شده است:
Hello World - اصول مطلق استفاده از LiteRT را برای میکروکنترلرها نشان می دهد
تشخیص شخص - داده های دوربین را با یک حسگر تصویر برای تشخیص حضور یا عدم حضور یک فرد ضبط می کند
گردش کار
مراحل زیر برای استقرار و اجرای یک مدل TensorFlow روی یک میکروکنترلر لازم است:
آموزش یک مدل :
یک مدل TensorFlow کوچک ایجاد کنید که می تواند با دستگاه مورد نظر شما متناسب باشد و شامل عملیات پشتیبانی شده باشد.
با استفاده از مبدل LiteRTبه مدل LiteRT تبدیل کنید .
با استفاده از ابزارهای استانداردبه آرایه بایت C تبدیل کنید تا آن را در حافظه برنامه فقط خواندنی روی دستگاه ذخیره کنید.
استنتاج را روی دستگاه با استفاده از کتابخانه C++ اجرا کنید و نتایج را پردازش کنید.
محدودیت ها
LiteRT برای میکروکنترلرها برای محدودیت های خاص توسعه میکروکنترلر طراحی شده است. اگر روی دستگاههای قدرتمندتری کار میکنید (به عنوان مثال، یک دستگاه لینوکس جاسازی شده مانند Raspberry Pi)، یکپارچهسازی چارچوب استاندارد LiteRT ممکن است آسانتر باشد.
تاریخ آخرین بهروزرسانی 2025-07-28 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-07-28 بهوقت ساعت هماهنگ جهانی."],[],[],null,["# LiteRT for Microcontrollers is designed to run machine learning models\non microcontrollers and other devices with only a few kilobytes of memory. The\ncore runtime just fits in 16 KB on an Arm Cortex M3 and can run many basic\nmodels. It doesn't require operating system support, any standard C or C++\nlibraries, or dynamic memory allocation.\n| **Note:** The [LiteRT for Microcontrollers Experiments](https://experiments.withgoogle.com/collection/tfliteformicrocontrollers) features work by developers combining Arduino and TensorFlow to create awesome experiences and tools. Check out the site for inspiration to create your own TinyML projects.\n\nWhy microcontrollers are important\n----------------------------------\n\nMicrocontrollers are typically small, low-powered computing devices that are\nembedded within hardware that requires basic computation. By bringing machine\nlearning to tiny microcontrollers, we can boost the intelligence of billions of\ndevices that we use in our lives, including household appliances and Internet of\nThings devices, without relying on expensive hardware or reliable internet\nconnections, which is often subject to bandwidth and power constraints and\nresults in high latency. This can also help preserve privacy, since no data\nleaves the device. Imagine smart appliances that can adapt to your daily\nroutine, intelligent industrial sensors that understand the difference between\nproblems and normal operation, and magical toys that can help kids learn in fun\nand delightful ways.\n\nSupported platforms\n-------------------\n\nLiteRT for Microcontrollers is written in C++ 17 and requires a 32-bit\nplatform. It has been tested extensively with many processors based on the\n[Arm Cortex-M Series](https://developer.arm.com/ip-products/processors/cortex-m)\narchitecture, and has been ported to other architectures including\n[ESP32](https://www.espressif.com/en/products/hardware/esp32/overview). The\nframework is available as an Arduino library. It can also generate projects for\ndevelopment environments such as Mbed. It is open source and can be included in\nany C++ 17 project.\n\nThe following development boards are supported:\n\n- [Arduino Nano 33 BLE Sense](https://store-usa.arduino.cc/products/arduino-nano-33-ble-sense-with-headers)\n- [SparkFun Edge](https://www.sparkfun.com/products/15170)\n- [STM32F746 Discovery kit](https://www.st.com/en/evaluation-tools/32f746gdiscovery.html)\n- [Adafruit EdgeBadge](https://www.adafruit.com/product/4400)\n- [Adafruit LiteRT for Microcontrollers Kit](https://www.adafruit.com/product/4317)\n- [Adafruit Circuit Playground Bluefruit](https://learn.adafruit.com/tensorflow-lite-for-circuit-playground-bluefruit-quickstart?view=all)\n- [Espressif ESP32-DevKitC](https://www.espressif.com/en/products/hardware/esp32-devkitc/overview)\n- [Espressif ESP-EYE](https://www.espressif.com/en/products/hardware/esp-eye/overview)\n- [Wio Terminal: ATSAMD51](https://www.seeedstudio.com/Wio-Terminal-p-4509.html)\n- [Himax WE-I Plus EVB Endpoint AI Development Board](https://www.sparkfun.com/products/17256)\n- [Synopsys DesignWare ARC EM Software Development Platform](https://www.synopsys.com/dw/ipdir.php?ds=arc-em-software-development-platform)\n- [Sony Spresense](https://developer.sony.com/develop/spresense/)\n\nExplore the examples\n--------------------\n\nEach example application is on\n[GitHub](https://github.com/tensorflow/tflite-micro/blob/main/tensorflow/lite/micro/examples)\nand has a `README.md` file that explains how it can be deployed to its supported\nplatforms. Some examples also have end-to-end tutorials using a specific\nplatform, as given below:\n\n- [Hello World](https://github.com/tensorflow/tflite-micro/blob/main/tensorflow/lite/micro/examples/hello_world) - Demonstrates the absolute basics of using LiteRT for Microcontrollers\n - [Tutorial using any supported device](./get_started)\n- [Micro speech](https://github.com/tensorflow/tflite-micro/blob/main/tensorflow/lite/micro/examples/micro_speech) - Captures audio with a microphone to detect the words \"yes\" and \"no\"\n - [Tutorial using SparkFun Edge](https://codelabs.developers.google.com/codelabs/sparkfun-tensorflow/#0)\n- [Person detection](https://github.com/tensorflow/tflite-micro/blob/main/tensorflow/lite/micro/examples/person_detection) - Captures camera data with an image sensor to detect the presence or absence of a person\n\nWorkflow\n--------\n\nThe following steps are required to deploy and run a TensorFlow model on a\nmicrocontroller:\n\n1. **Train a model** :\n - *Generate a small TensorFlow model* that can fit your target device and contains [supported operations](./build_convert#operation_support).\n - *Convert to a LiteRT model* using the [LiteRT converter](./build_convert#model_conversion).\n - *Convert to a C byte array* using [standard tools](./build_convert#convert_to_a_c_array) to store it in a read-only program memory on device.\n2. **Run inference** on device using the [C++ library](./library) and process the results.\n\nLimitations\n-----------\n\nLiteRT for Microcontrollers is designed for the specific constraints of\nmicrocontroller development. If you are working on more powerful devices (for\nexample, an embedded Linux device like the Raspberry Pi), the standard\nLiteRT framework might be easier to integrate.\n\nThe following limitations should be considered:\n\n- Support for a [limited subset](./build_convert#operation_support) of TensorFlow operations\n- Support for a limited set of devices\n- Low-level C++ API requiring manual memory management\n- On device training is not supported\n\nNext steps\n----------\n\n- [Get started with microcontrollers](./get_started) to try the example application and learn how to use the API.\n- [Understand the C++ library](./library) to learn how to use the library in your own project.\n- [Build and convert models](./build_convert) to learn more about training and converting models for deployment on microcontrollers."]]