{"id":15925,"date":"2024-09-04T13:06:32","date_gmt":"2024-09-04T17:06:32","guid":{"rendered":"https:\/\/blogs.mathworks.com\/deep-learning\/?p=15925"},"modified":"2024-10-03T21:47:01","modified_gmt":"2024-10-04T01:47:01","slug":"embedded-ai-integration-with-matlab-and-simulink","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/deep-learning\/2024\/09\/04\/embedded-ai-integration-with-matlab-and-simulink\/","title":{"rendered":"Embedded AI Integration with MATLAB and Simulink"},"content":{"rendered":"<h6><\/h6>\r\nEmbedded AI, that is the integration of artificial intelligence and embedded systems, enables devices to process data and make decisions locally. It enhances efficiency, reduces latency, and improves user experience. This blog post describes what Embedded AI is, highlights the benefits of using MATLAB and Simulink for Embedded AI, and provides an overview of a recent webinar on Embedded AI.\r\n<h6><\/h6>\r\nBlog post contents:\r\n<h6><\/h6>\r\n<ul>\r\n \t<li><a href=\"#What_Is_Embedded_AI\">What Is Embedded AI?<\/a><\/li>\r\n \t<li><a href=\"#Why_MATLAB\">Why MATLAB and Simulink for Embedded AI?<\/a><\/li>\r\n \t<li><a href=\"#Webinar\">Overview of Embedded AI Webinar<\/a><\/li>\r\n<\/ul>\r\n<h6><\/h6>\r\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15965 size-full\" src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/webinar_workflow.png\" alt=\"Embedded AI workflow as presented in the Embedded AI integration with MATLAB and Simulink webinar\" width=\"1128\" height=\"493\" \/>\r\n<h6><\/h6>\r\n<strong>Figure:<\/strong> The complete embedded AI workflow, as presented and explained in recent webinar.\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 20px; color: #c04c0b;\"><a name=\"What_Is_Embedded_AI\"><\/a><strong>What Is Embedded AI?<\/strong><\/p>\r\nEmbedded AI is the integration of <a href=\"https:\/\/www.mathworks.com\/discovery\/artificial-intelligence.html\">artificial intelligence<\/a> (AI) capabilities directly into embedded systems. Embedded AI refers to both <a href=\"https:\/\/www.mathworks.com\/solutions\/artificial-intelligence\/ai-signal-processing.html\">signal<\/a> and <a href=\"https:\/\/www.mathworks.com\/solutions\/artificial-intelligence\/ai-computer-vision.html\">vision<\/a> applications. For image and video data, Embedded AI is also known as Embedded Vision.\r\n<h6><\/h6>\r\nAn embedded system is a combination of computer hardware and software designed for a specific function or functions within a larger system. These systems can be found in a variety of applications, from automotive and aerospace to consumer electronics and industrial automation. Embedded systems typically have real-time computing constraints, and they are optimized for specific tasks, often with limited resources such as memory and processing power.\r\n<h6><\/h6>\r\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15955 \" src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/virtual_sensor2.png\" alt=\"Virtual sensor designed with AI, using voltage, current, and temperature measurements to predict battery state-of-charge (SOC)\" width=\"516\" height=\"169\" \/>\r\n<h6><\/h6>\r\n<strong>Figure:<\/strong> \u00a0A <a href=\"https:\/\/blogs.mathworks.com\/deep-learning\/2023\/08\/11\/virtual-sensors-with-ai-and-model-based-design\">virtual sensor designed with AI<\/a> is an example of an Embedded AI system. A virtual sensor for estimating battery State-of-Charge (SOC) is shown.\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Key Characteristics<\/strong><\/p>\r\nWhen we are talking about Embedded AI, there are three key features that you need to remember:\r\n<h6><\/h6>\r\n<ul>\r\n \t<li><strong>Integration with Hardware <\/strong>- AI algorithms are integrated into the device hardware, often requiring optimization to run efficiently on limited resources.<\/li>\r\n \t<li><strong>Dedicated Functions<\/strong> - The AI capabilities are tailored to specific applications, such as voice recognition in smart speakers or image processing in cameras.<\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li><strong>Limited Resources<\/strong> - Embedded systems typically have constraints on processing power, memory, and energy consumption.<\/li>\r\n<\/ul>\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Embedded AI vs Edge AI vs TinyML<\/strong><\/p>\r\nThe terms Embedded AI, <a href=\"https:\/\/www.mathworks.com\/solutions\/deep-learning\/edge-ai.html\">Edge AI<\/a>, and <a href=\"https:\/\/www.mathworks.com\/discovery\/tinyml.html\">TinyML<\/a> refer to closely related but distinct concepts within the field of artificial intelligence, each with its unique focus and application domains. All three approaches have a component of real-time or near-real-time processing.\r\n<h6><\/h6>\r\nThe key attribute of Embedded AI is a resource-constrained target, such as an MCU (microcontroller unit), that cannot use libraries. Thus, Embedded AI requires embedded code (C\/C++ or HDL). Edge AI is Embedded AI plus running AI models on industrial computers. Industrial computers have much more resources than embedded systems. TinyML is a sub-area of Embedded AI, which brings AI to the smallest MCUs and sensors, and thus operates under the most stringent limitations.\r\n<h6><\/h6>\r\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15974 size-full\" src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/visual_inspection_system.png\" alt=\"Visual inspection system with AI and PLC\" width=\"959\" height=\"452\" \/>\r\n<h6><\/h6>\r\n<strong>Figure:<\/strong> Edge AI system for visual inspection on an industrial computer (see <a href=\"https:\/\/blogs.mathworks.com\/deep-learning\/2024\/08\/07\/automating-visual-inspection-with-ai-and-plc\/\">blog post<\/a>)\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 20px; color: #c04c0b;\"><a name=\"Why_MATLAB\"><\/a><strong>Why MATLAB and Simulink for Embedded AI?<\/strong><\/p>\r\nYou can use MATLAB and Simulink to design, simulate, test, verify, and deploy Embedded AI algorithms that enhance the performance and functionality of complex engineering systems. MATLAB and Simulink provide a complete and versatile set of tools for designing complex AI-empowered embedded systems for applications such as enhancing a quality inspection robot with deep learning or developing a control system that uses virtual sensors for temperature estimation.\r\n<h6><\/h6>\r\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15980 \" src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/quality_inspection_robot-scaled.jpg\" alt=\"Visual inspection automation at the assembly line with AI\" width=\"513\" height=\"342\" \/>\r\n<h6><\/h6>\r\n<strong>Figure:<\/strong> Quality inspection robot empowered by AI\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Key Benefits<\/strong><\/p>\r\nSome of the key benefits of using MATLAB and Simulink tools for Embedded AI are:\r\n<h6><\/h6>\r\n<ul>\r\n \t<li><em><u>Simulation and Testing of AI-driven systems in Simulink<\/u><\/em><em>.<\/em> Trained machine learning models can be easily integrated into Simulink systems using provided Simulink blocks. You can evaluate the model performance within the system, and perform processor-in-the-loop (PIL) or hardware-in-the-loop (HIL) testing. To learn more, see <a href=\"https:\/\/www.mathworks.com\/campaigns\/offers\/ai-system-level-design.html\">Integrating AI into System-Level Design<\/a> and\u00a0<a href=\"https:\/\/www.mathworks.com\/solutions\/ai-model-based-design.html\">AI with Model-Based Design<\/a>.<\/li>\r\n<\/ul>\r\n<ul>\r\n \t<li><em><u>Integration between MATLAB and Python for deep learning.<\/u><\/em> You can import pretrained deep learning models from PyTorch\u00ae, TensorFlow\u2122, and ONNX\u2122 into MATLAB. You can also export deep neural networks from MATLAB to TensorFlow and ONNX. To learn more, check out <a href=\"https:\/\/blogs.mathworks.com\/deep-learning\/2024\/04\/22\/convert-deep-learning-models-between-pytorch-tensorflow-and-matlab\/\">Convert Deep Learning Models between PyTorch, TensorFlow, and MATLAB<\/a>.<\/li>\r\n<\/ul>\r\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15986 \" src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/interop.png\" alt=\"Convert deep learning models between MATLAB, PyTorch, TensorFlow, and PyTorch\" width=\"537\" height=\"279\" \/>\r\n<h6><\/h6>\r\n<strong>Figure:<\/strong> Conversion of deep learning models between MATLAB, PyTorch, TensorFlow, and ONNX\r\n<h6><\/h6>\r\n<ul>\r\n \t<li><em><u>Deployment to Resource-Constrained Targets.<\/u><\/em> You can generate plain C\/C++ source code (with no dependency on a runtime or interpreter) for CPUs and microcontrollers, CUDA code for NVIDIA\u00ae GPUs, and Verilog and VHDL\u00ae code for AMD &amp; Intel\u00ae FPGAs and SoCs. You can also compress models to reduce their computational costs by performing pruning, projection or quantization.<\/li>\r\n<\/ul>\r\n<img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15995 size-full\" src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/tinyml_codegen.jpeg\" alt=\"Automatic code generation for deep learning model deployed to PCB\" width=\"1200\" height=\"580\" \/>\r\n<strong>Figure:<\/strong> Automatic code generation from MATLAB and Simulink enables rapid prototyping and deployment of AI applications on embedded devices\r\n<h6><\/h6>\r\n<ul>\r\n \t<li><em><u>Verification and Validation for AI.<\/u><\/em> You can verify and validate AI models, especially in safety-critical industries such as automotive, aerospace, and medical devices (to learn more, see <a href=\"https:\/\/blogs.mathworks.com\/deep-learning\/2024\/04\/30\/verification-and-validation-for-ai-from-model-implementation-to-requirements-validation\/\">blog post series: Verification and Validation for AI<\/a>). You can apply <a href=\"https:\/\/www.youtube.com\/watch?v=It2Q1eK_Klc\" target=\"_blank\" rel=\"noopener\">explainable AI<\/a> techniques for machine learning and deep learning models, and verify the robustness of deep neural networks with <a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/118735-deep-learning-toolbox-verification-library\">Deep Learning Toolbox Verification Library<\/a>.<\/li>\r\n<\/ul>\r\n<h6><img decoding=\"async\" loading=\"lazy\" class=\"alignnone wp-image-15989 size-full\" src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/AIvv.png\" alt=\"W-shaped development cycle for Verification and Validation for AI\" width=\"869\" height=\"477\" \/><\/h6>\r\n<strong>Figure:<\/strong> W-shaped development process. Credit: EASA, Daedalean\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Discover More<\/strong><\/p>\r\nCheck out these customer stories featuring Embedded AI systems built with MATLAB and Simulink:\r\n<h6><\/h6>\r\n<ul>\r\n \t<li><a href=\"https:\/\/www.mathworks.com\/company\/user_stories\/coca-cola-develops-virtual-pressure-sensor-with-machine-learning-to-improve-beverage-dispenser-diagnostics.html\">Coca-Cola Develops Virtual Pressure Sensor with Machine Learning to Improve Beverage Dispenser Diagnostics<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.mathworks.com\/company\/user_stories\/mercedes-benz-simulates-hardware-sensors-with-deep-neural-networks.html\">Mercedes-Benz Simulates Hardware Sensors with Deep Neural Networks<\/a><\/li>\r\n \t<li><a href=\"https:\/\/www.mathworks.com\/company\/user_stories\/miba-ag-develops-ai-powered-quality-inspection-system.html\">Miba AG Creates Deep Learning System for Enhanced Quality Inspection<\/a><\/li>\r\n<\/ul>\r\nTo further explore Embedded AI and other AI applications, see <a href=\"https:\/\/www.mathworks.com\/solutions\/artificial-intelligence.html\">MATLAB and Simulink for Artificial Intelligence<\/a>.\r\n<h6><\/h6>\r\n&nbsp;\r\n<h6><\/h6>\r\n<p style=\"font-size: 20px; color: #c04c0b;\"><a name=\"Webinar\"><\/a><strong>Embedded AI Webinar<\/strong><\/p>\r\nWatch <a href=\"https:\/\/www.linkedin.com\/in\/reed-axman-43287a13b\/\" target=\"_blank\" rel=\"noopener\">Reed Axman<\/a> in the recent webinar: <a href=\"https:\/\/www.mathworks.com\/videos\/embedded-ai-integration-with-matlab-and-simulink-1727763384659.html\">Embedded AI Integration with MATLAB and Simulink<\/a>. Reed, who is a Strategic Partner Specialist at MathWorks focusing on AI deployment workflows to MCUs, shares his experience with enabling engineers to add AI capabilities to their embedded systems.\r\n<h6><\/h6>\r\nThis webinar offers a comprehensive guide on how to incorporate AI models tailored for deployment to MCUs into systems designed with MATLAB and Simulink. This helps Embedded AI engineers who seek to streamline the process of importing AI, testing and verifying networks within their existing Simulink models, and generating deployment-ready code.\r\n<h6><\/h6>\r\n<p style=\"font-size: 18px;\"><strong>Webinar Highlights<\/strong><\/p>\r\n\r\n<ul>\r\n \t<li>Engineers can incorporate AI into their Simulink models with confidence, ensuring that the AI models function as intended when deployed in their products.<\/li>\r\n \t<li>The process of testing and verifying the robustness of the AI model within Simulink systems is simplified, allowing for direct and efficient validation of the AI model's performance.<\/li>\r\n \t<li>The generation of deployment-ready code is automated, enabling engineers to rapidly move from model to deployment on MCUs without the complexities of manual code translation.<\/li>\r\n<\/ul>","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/deep-learning\/files\/2024\/09\/webinar_workflow.png\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div><p>\r\nEmbedded AI, that is the integration of artificial intelligence and embedded systems, enables devices to process data and make decisions locally. It enhances efficiency, reduces latency, and... <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/deep-learning\/2024\/09\/04\/embedded-ai-integration-with-matlab-and-simulink\/\">read more >><\/a><\/p>","protected":false},"author":194,"featured_media":15965,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[36,9,68,12,33,51],"tags":[],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts\/15925"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/users\/194"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/comments?post=15925"}],"version-history":[{"count":39,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts\/15925\/revisions"}],"predecessor-version":[{"id":16340,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/posts\/15925\/revisions\/16340"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/media\/15965"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/media?parent=15925"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/categories?post=15925"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/deep-learning\/wp-json\/wp\/v2\/tags?post=15925"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}