We detect you are using an unsupported browser. For the best experience, please visit the site using Chrome, Firefox, Safari, or Edge. X
Maximize Your Experience: Reap the Personalized Advantages by Completing Your Profile to Its Fullest. Update Here
Stay in the loop with the latest from Microchip. Update your profile while you are at it. Update Here
Complete your profile to access more resources. Update Here

Bringing TensorFlow to the Edge: Introducing tf2mplabh3 by Microchip Technology

Microchip Technology introduces tf2mplabh3, an open-source Python package designed to streamline the deployment of TensorFlow 2.x models onto embedded systems.

At Microchip Technology, we’re committed to simplifying the journey from machine learning model development to deployment on embedded systems.That’s why we’ve released tf2mplabh3, an open-source Python package that bridges TensorFlow and Microchip’s bare-metal frameworks.

What Is tf2mplabh3?

tf2mplabh3 is a wrapper that enables developers to convert TensorFlow 2.x models into a C model file optimized for a seamless integration into MPLAB® X projects.This tool is designed to help embedded engineers take advantage of pre-trained or custom TensorFlow models and deploy them efficiently onto our broad range of MCUs and MPUs.

Key Features

  • Model Conversion: Seamlessly converts a TensorFlow SavedModel into a unique C model file that contains both the model weights and the inference engine
  • Flexible Model Support: Supports original float32 models or their int8 quantized equivalent
  • Robust Output Consistency: Provides reliable model deployment by achieving near-identical outputs between the original TensorFlow model and the compiled one, with negligible error metrics and 100% agreement in Top-1 and Top-5 predictions on a MobileNet V2 example (See this link for more information)

Why It Matters

Deploying machine learning models to edge devices—especially in resource-constrained environments—is complex. tf2mplabh3 removes the friction by abstracting the technical hurdles and aligning tightly with our embedded tools. Whether you're working with tiny ML models on 8-bit MCUs or using more advanced neural networks on 32-bit and 64-bit CPUs, this tool helps accelerate your edge AI deployment.

Inference Time Optimizations

Optimizing inference time is crucial for real-world embedded AI applications. By leveraging Microchip XC Compilers—such as XC32-gcc—alongside tf2mplabh3, developers can achieve significant performance improvements. The MPLAB XC32-gcc compiler supports advanced features like autovectorization, which automatically optimizes code to take advantage of available hardware acceleration.

Example: SAMA5D2 Series Microprocessors

The SAMA5D2 is a low-power, Arm® Cortex®-A5 based 32-bit microprocessor product line, making it suitable for battery-operated and resource-constrained applications. The Cortex-A5 core is built on the ARMv7 architecture, which includes the Arm NEON™ architecture extension, a vectorization engine. Arm NEON enables efficient parallel processing of data, significantly accelerating compute-intensive tasks such as machine learning inference.

When deploying a TensorFlow model converted with tf2mplabh3 and compiled with MPLAB XC32-gcc, the SAMA5D29 demonstrated an impressive 84% reduction in inference time. This performance boost is a direct result of compiler optimizations that fully leverage the Arm NEON engine and other hardware capabilities. This example highlights the powerful synergy between tf2mplabh3, Microchip’s hardware and the MPLAB XC compiler suite for efficient AI at the edge.

Get Started

Check out the GitHub repository to explore the documentation, installation instructions and benchmarking informations. Contributions and feedback are welcome!

Hakim Cherif, Sep 9, 2025
Tags/Keywords: AI-ML