Making AI Accessible with STM32

Click the above to follow STM32

Making AI Accessible with STM32

Making AI Accessible with STM32
Artificial intelligence has moved from a high-tech domain to multi-scenario applications,and in this process, embedded technology will become an important carrier platform for AI implementation.
Not long ago, the 2020 World Artificial Intelligence Conference (WAIC) just concluded in Shanghai, reigniting the concept of artificial intelligence in the industry. At the conference, industry leaders gathered to discuss AI innovation and explore governance solutions for artificial intelligence.
Li Yanhong stated that the development of AI will go through three major historical stages. The first stage is the intelligence of technology, the second stage is the intelligence of the economy, and the third stage is the intelligence of society. Currently, we are transitioning from the first half of economic intelligence to the second half.
Elon Musk mentioned that if AI must be divided into three categories: perception, cognition, and action, we have currently achieved perception, while cognition is the weakest link.
Meanwhile, Ding Lei stated that artificial intelligence is not a technical issue, but an application scenario issue. Choosing the right application scenario can yield very high efficiency.
It can be seen that the views of the tech giants converge; currently, artificial intelligence has shifted from technology to application. The key is how to truly implement AI technology to meet the actual needs of people in each application scenario. In this process, embedded technology will become an important carrier platform for AI implementation.

What is the relationship between AI, machine learning, and deep learning?

AI is a superset of all research that involves machines mimicking human cognitive abilities, such as interaction with the environment, knowledge representation, perception, learning, computer vision, speech recognition, problem-solving, etc.

Making AI Accessible with STM32

Relationship diagram between AI, machine learning, and deep learning

Machine learning is a branch of AI. Its application in computer science allows computers to learn without explicit programming. Machine learning consists of algorithms that can learn and predict based on data: these algorithms are trained on previous samples to build and estimate models; machine learning is often used when traditional programming is not feasible; if properly trained, it can adapt to new case applications.

There are different implementation methods of machine learning, including common ones: decision trees, clustering, rule-based learning, inductive logic programming, and deep learning.

Deep learning (DL) is a subset of machine learning. It is a method based on representation learning from data and can simulate the neural structure of the human brain. It mainly includes four typical deep learning algorithms: Convolutional Neural Networks (CNN), Recurrent Neural Networks (RNN), Generative Adversarial Networks (GANs), and Deep Reinforcement Learning (RL).

Making AI Accessible with STM32

Neural network hierarchy

What are the advantages and disadvantages of deep learning?

The “depth” of deep learning refers to the number of layers experienced from the “input layer” to the “output layer,” that is, the number of “hidden layers.” The more layers, the deeper the depth. Therefore, the more complex the selection problem, the more depth is needed. For example, AlphaGo’s strategy network has 13 layers, with 192 neurons in each layer. Deep learning requires a large amount of data.

Deep learning and machine learning differ significantly in terms of data volume. Current experiments and work have proven that the size of the data directly affects the performance of deep learning. We all hope to achieve good results with small datasets and simple algorithms, but the reality is that using deep learning on small datasets often leads to overfitting.

Making AI Accessible with STM32
Making AI Accessible with STM32

The relationship between data volume and algorithm performance

Since the emergence of big data and super powerful GPUs, the potential of deep learning is being continuously explored. Its advantages are manifested in:

  • Strong learning ability (autonomous learning of data patterns and relationships). From results, deep learning performs very well with a strong learning ability.

  • Data-driven, high accuracy.Deep learning highly relies on data; the larger the data volume, the better its performance. In tasks such as image recognition, facial recognition, and NLP, it has even surpassed human performance. It can also be further improved by tuning parameters.

  • Easy to improve and fine-tune.By initializing the existing model parameters, one can fine-tune the parameters based on their own dataset, saving a lot of time.

  • Good portability and adaptability.Due to the excellent performance of deep learning, many frameworks can be used, such as TensorFlow and Pytorch. These frameworks are compatible with many platforms.

Making AI Accessible with STM32

Strengths and weaknesses of deep learning

Its disadvantages are manifested in:

  • Requires large datasets and high computational load. Deep learning requires a lot of data, making it costly. Moreover, many applications are still not suitable for use on mobile devices.

  • Complex model design, requiring high computing power. Deep learning has high computing requirements; model design is very complex, requiring substantial human and material resources, and time to develop new algorithms and models. Most people can only use existing models.

  • Lacks “humanity,” prone to bias. Since deep learning relies on data and has low interpretability, it can lead to issues such as gender and racial discrimination when training data is imbalanced.

STM32 Makes AI Accessible

As an expert in the semiconductor industry, ST has been at the forefront of exploring embedded AI applications, providing rich STM32 MCU products and solutions based on Arm Cortex-M for AI applications.

The advantages of STM32 in AI applications include:

  • Low power consumption

  • Versatility (one chip meets both AI and general needs)

  • Rich product series

  • Industrial-grade quality and 10-year supply guarantee

Making AI Accessible with STM32

STM32 products with M4 core and above can achieve AI applications

Taking the processing needs of machine vision as an example, from low-resolution images with good lighting and low processing needs to moderate processing needs under low frame rates and open environments with moderate lighting, and finally to high processing capability needs under high-speed video, high resolution, and adaptable lighting conditions, STM32 provides corresponding solutions to meet specific application needs.

Making AI Accessible with STM32

Processing needs of machine vision

From a market application perspective, STM32 is mainly positioned in the low-end machine vision market, sound-based applications, and condition monitoring and predictive maintenance applications.

Making AI Accessible with STM32
Making AI Accessible with STM32
Making AI Accessible with STM32

Market positioning of STM32

Making AI Accessible with STM32

To help users develop embedded AI more quickly, ST also provides rich deep learning resources covering the entire process of neural network development.

Making AI Accessible with STM32

Neural network development process

Step 1: Data Acquisition

At this stage, ST provides hardware development boards and software to collect data such as motion and sound. Hardware development boards include: SensorTile, SensorTile.Box, IOT Node (B-L475E-IOT01A).
Making AI Accessible with STM32 Making AI Accessible with STM32 Making AI Accessible with STM32

Scroll up and down to view images

Users can purchase development boards and obtain software through the following channels:

  • Purchase development boards at the STM32 Tmall flagship store: Taobao code ₳NCmB1zyeeWZ₳

  • Software: FP-AI-SENSING1, download link:http://navo.top/zayQfi

Step 2: Data Cleaning and Labeling

ST also provides a mobile app that connects directly to the hardware development board, serving as a platform for initial data screening and collection.

ST BLE SensorAPP (supports Android, IOS, open source) download link: http://navo.top/uayaye

Step 3: Train the Neural Network Model

The training of the neural network is completed on a server or PC; ST does not provide a solution. However, corresponding reference training scripts are provided in the examples.

Step 4: Convert the model to optimized code for execution on the MCU

STM32Cube.AI is an advanced toolkit launched by ST that can interoperate with popular deep learning libraries to convert any artificial neural network for application on STM32 microcontrollers (MCUs). The Cube.AI tool is an AI extension package for CubeMX, available for download within CubeMX or separately, download link: http://navo.top/rq2uqm.

Supported neural network model frameworks by STM32Cube.AI include Lasagne, Keras, Caffe, ConvNetJs, Tensorflow Lite, and can be exported to ONNX standard frameworks (PyTorch™, Microsoft® Cognitive Toolkit, MATLAB®, and more). For the latest support, please refer to the Cube.AI release note.

The functions of the Cube.AI tool include:

  • Convert model files to C code running on STM32

  • Analyze CPU, RAM, Flash resource usage of model files, displaying compatible MCU models

  • Perform integer quantization or deep compression on models

  • More features are being updated…

For tutorials on using the Cube.AI tool, please refer to the following training course: “Developing AI Applications Based on STM32” (copy the URL to an external browser)

https://c.51diantang.com/columndetail?id=046ea06e6d1d476ab49a2cbbf84e43ab

Step 5: Use the trained model to analyze data
  1. For motion and sound data, ST can provide hardware development boards including: SensorTile, SensorTile.Box, IOT Node (B-L475E-IOT01A); ST provides software including: FP-AI-SENSING1, download link: http://navo.top/zayQfi

  2. For image data, ST can provide hardware development boards including: STM32H747I-DISCO + STM32F4DIS-CAM or OpenMV

Making AI Accessible with STM32Making AI Accessible with STM32

Users can purchase development boards and obtain software through the following channels:

  • Purchase development boards at the STM32 Tmall flagship store: Taobao code ₳wMEr1zyloyE₳

  • OpenMV official agent: Taobao code ₴m1xH1zyrco2₴

  • Software: FP-AI-VISION1, download link: http://navo.top/rMJbY3

ST Promotes AI Education through University Programs

ST has been working closely with world-renowned universities to promote the training and dissemination of AI knowledge and applications in the education sector. ST has collaborated with professors from UCLA to launch courses on IoT and embedded machine learning. This course, based on ST’s SensorTile development kit, provides young engineers and technicians with the foundation needed to build IoT systems (such as wearable consumer devices, wearable medical devices, residential IoT systems, and vehicle IoT systems).

Since opening its first joint laboratory at Shanghai Jiao Tong University in 2007, ST has established significant partnerships in the education sector in China. The ST China University Program collaborates with several Chinese universities to jointly develop textbooks and curricula related to embedded systems, IoT, and artificial intelligence, and promotes these through faculty training to more Chinese universities; at the same time, an ST Education Alliance has been established to facilitate close cooperation with higher education institutions.

In terms of AI applications, ST has collaborated for a long time with many professors who write core training materials. Professor Wang Yihuai from Soochow University is developing a textbook that explains complex embedded system AI concepts using STM32 microcontrollers and STM32Cube.AI. By using ST’s AI tools to convert neural networks into code that can run on STM32, teachers can provide students with advanced and clever AI solutions.

Related links for Professor Wang Yihuai’s course on Object Recognition Systems at Soochow University:
http://sumcu.suda.edu.cn/AIwEORS/list.htm

Related links for reference:

1. Original development board purchase link for B-L475E-IOT01A1: https://detail.tmall.com/item.htm?spm=a1z10.5-b-s.w4011-19008516737.51.45256f8adZSI3p&id=603276083863&rn=0136462d284ed487c21e9c7c6cda900b&abbucket=7

2. STM32H747I-DISCO, Original development board purchase link
https://detail.tmall.com/item.htm?spm=a220m.1000858.1000725.1.8bb67edepERQUP&id=607575822149&user_id=4131769642&cat_id=2&is_b=1&rn=ba1e0cb21d2ba17517418ef8a2b22eb3l
3. OpenMV official agentTaobao purchase link
https://kaizhi-xu.taobao.com/index.htm?spm=2013.1.w5001-14519673283.2.63a876739H8mFg&scene=taobao_shop

© THE END

Making AI Accessible with STM32
Click “Read the original text” to learn more about AI solutions based on STM32

Leave a Comment

×