Subscribe to Email Updates

Recent Stories

Unlocking Sustainability with Circularity
Unlocking Sustainability with Circularity Cyient
Unlocking Sustainability with Circularity
Accelerating Digital Transformation in Industry: Cyient's Proven Approach
Accelerating Digital Transformation in Industry: Cyient's Proven Approach Cyient
Accelerating Digital Transformation in Industry: Cyient's Proven Approach
Building an Efficient Face Recognition System
Building an Efficient Face Recognition System Cyient
Building an Efficient Face Recognition System
The Symphony of Automation: RPA and GenAI across Industries
The Symphony of Automation: RPA and GenAI across Industries Cyient
The Symphony of Automation: RPA and GenAI across Industries
GeoAI in Pipeline Monitoring and Management
GeoAI in Pipeline Monitoring and Management Cyient
GeoAI in Pipeline Monitoring and Management
Meet Rajeshbhai Dedakiya Meet Rajeshbhai Dedakiya Written by Meet Rajeshbhai Dedakiya, Software Developer, Technology Group
on 13 Mar 2023

Technology is continuously evolving and artificial intelligence and machine learning are among the fastest-growing technologies today, making a tangible impact across industries. Python is one of the trending scripting languages developers use for algorithms and system setup. It is a high-level programming language developed in the 1990s, as easy as reading and writing in English. Python provides an easy interface with an exhaustive library, which helps develop algorithms easily. It provides thousands of modules that help developers to use and access various APIs. Python is used as much for developing small tasks as for implementing complex projects in large industries. Several complex algorithms based on OpenCV for camera for object detection or face recognition are developed easily in Python. A growing pool of industry experts has formed a community of developers to apply automotive advanced driving assistance system (ADAS)-based application modules employing sensor fusion support such as radar and ultrasonic.

Python helps developers to be more productive and increases confidence across the development to deployment phases. But deployment in different target platforms is complex and difficult to execute because of the huge library size and complex code. Most target platforms don’t support Python script execution and require code in C or C++ with header files. Conversion of the Python script into C/C++ programming is also possible, but Python libraries are too large and complex to convert into C/C++ code.

MATLAB as a development tool

Since Python is becoming a bottleneck at the time of deployment in the target platform, another popular tool, MATLAB, managed by MathWorks, is used for development in this area, while M-script, similar to Python scripting, is used as a scripting language for development in MATLAB. MATLAB’s advantage is that it has a code generation feature that generates code for a specific target platform based on the requirement. This feature makes the deployment cycle much easier and bug-free compared to Python.

MATLAB is a proprietary tool used by several large corporations for model-based development. Automotive projects largely use MATLAB as a development tool to deal with the complexity, and model-based development makes it easy to develop the algorithm and debug flaws by visualizing the flow in the model. This developed model is then converted into C/C++ code using the code generation feature that can be deployed directly onto the hardware.

MATLAB plays a vital role in developing ADAS solutions, which are related to camera, LiDAR, radar etc., as it provides different libraries for development, simulation, and testing. MATLAB has different apps to create real-time scenarios that help the developer test the algorithm to assess real-time behavior and solve bugs.

MATLAB v/s Python

Provides code generation features for target board.  Code generation for target platform is not available. 
Has fewer libraries for development compared to Python.  Has a huge set of libraries that make development easier and faster. 
Has multiple toolboxes related to AI/ML such as the deep learning toolbox which has functions like animportONNXNetworkthat help convert the model from Python to MATLAB; but the network needs to be in the specific format and once imported, cannot be edited. Also, the supporting function cannot be imported/converted using this function.  Has a lot of libraries and functions to create AI/ML models and networks, but this model cannot be directly deployed onto any target platform. 


Framework for Python-to-MATLAB

To resolve the gap between the Python libraries and modules and MATLAB code generation, you need a framework that acts as a converter or a bridge between Python and MATLAB. This framework can act as a mediator between Python and MATLAB. It will convert the Python script to M-script, which then can be converted to the respective target platform code using code generation.

This framework converts all the supporting functions and APIs into M-script, which can further be converted into target-specific code. Complex libraries and modules available in Python can be used for algorithm development. Once the whole algorithm is ready for execution, this framework can convert it to M-script. The algorithm can be tested on the simulation for behavior in real time and can then be deployed or integrated into the target board using the code generation feature.

Python-to-M-scriptFlow chart for the Python-to-M-script framework 

For the ADAS solution, MATLAB provides a deep learning toolbox that complements this framework in solution development using machine learning and artificial intelligence. For example, the vehicle detection algorithm converted from the framework can be used along with the deep learning toolbox for better accuracy and prediction. The deep learning toolbox provides support to multiple algorithms in a similar manner. Further, MATLAB has features of auto labeling based on the requirement using its apps such as videolabeler and imagelabeler.


  • Faster time-to-market as deployment and debugging time is reduced.
  • Development is easier as vast open-source material is available on Python.

Development of this Python-to-MATLAB framework is critical for industries today, as most industries use Python and MATLAB for development. Hence a bridge/connector framework for conversion from Python to MATLAB will solve bottleneck issues for developers and help the product reach the market faster with better software quality.

Case Study

Developing and deploying the object detection algorithm for ADAS

For developing this algorithm, data collection, cleaning, and annotation can be done using Python, as it has numerous libraries. This accelerates the process. The algorithm can be developed in Python or MATLAB, depending on the requirement. MATLAB helps to develop the algorithm related to ADAS faster as many libraries related to ADAS, and AI/ML-ADAS algorithms are available. If Python is used for algorithm development, this framework can convert the algorithm from Python to MATLAB and deploy it directly onto the target device using the code generation feature.

If MATLAB is used as the algorithm development tool, then using this framework, the data cleaning process will be converted to a MATLAB script. The rest of the development and deployment process will be done in MATLAB.


About the author

Meet Rajeshbhai Dedakiya is a Data Scientist and has pursued Masters in Data Science from Bits Pilani. He has over 5 years of automotive industry experience with an interest in building new end-to-end solutions, that accelerate human well-being and developing different models for environmental protection.

Let Us Know What You Thought about this Post.

Put your Comment Below.

Talk to Us

Find out more about how you can maximize impact through our services and solutions.*

*Suppliers, job seekers, or alumni, please use the appropriate form.