Skip to content

Commit 30bf5ea

Browse files
committed
Add Dominica's updates to training-inference-pytorch
1 parent d336e4a commit 30bf5ea

File tree

5 files changed

+548
-330
lines changed

5 files changed

+548
-330
lines changed

content/learning-paths/embedded-and-microcontrollers/training-inference-pytorch/_index.md

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,37 @@
11
---
2-
title: Edge AI with PyTorch & ExecuTorch - Tiny Sentiment Analysis on Arm
3-
4-
draft: true
5-
cascade:
6-
draft: true
2+
title: Edge AI with PyTorch & ExecuTorch - Tiny Rock-Paper-Scissors on Arm
73

84
minutes_to_complete: 90
95

10-
who_is_this_for: This topic is for machine learning engineers, embedded AI developers, and researchers interested in deploying TinyML models for NLP on Arm-based edge devices using PyTorch and ExecuTorch.
6+
who_is_this_for: This learning path is for machine learning engineers, embedded AI developers, and researchers interested in deploying TinyML models on Arm-based edge devices. You will learn how to train and deploy a machine learning model for the classic game "Rock-Paper-Scissors" on edge devices. We'll use PyTorch and ExecuTorch, a framework designed for efficient on-device inference, to build and run a small-scale computer vision model.
7+
118

129
learning_objectives:
13-
- Train a custom CNN-based sentiment classification model implemented in PyTorch.
14-
- Optimize and convert the model using ExecuTorch for Arm-based edge devices.
15-
- Deploy and run inference on the Corstone-320 FVP.
10+
- Train a small Convolutional Neural Network (CNN) for image classification using PyTorch.
11+
- Understand how to use synthetic data generation for training a model when real-world data is limited.
12+
- Optimize and convert a PyTorch model into an ExecuTorch program (.pte) for Arm-based devices.
13+
- Run the trained model on a local machine to play an interactive mini-game, demonstrating model inference.
14+
1615

1716
prerequisites:
18-
- Basic knowledge of machine learning concepts.
19-
- It is advised to complete The Learning Path, [Introduction to TinyML on Arm using PyTorch and ExecuTorch](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm) before starting this learning path.
20-
- Familiarity with Python and PyTorch.
17+
- A basic understanding of machine learning concepts.
18+
- Familiarity with Python and the PyTorch library.
19+
- It is advised to first complete [Introduction to TinyML on Arm using PyTorch and ExecuTorch](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm) before starting this learning path.
2120
- A Linux host machine or VM running Ubuntu 22.04 or higher.
2221
- An Arm license to run the examples on the Corstone-320 Fixed Virtual Platform (FVP), for hands-on deployment.
2322

2423

2524
author: Dominica Abena O. Amanfo
2625

2726
### Tags
28-
skilllevels: Introductory
27+
skilllevels: Intermediate
2928
subjects: ML
3029
armips:
31-
- Cortex-A
30+
- Cortex-M
3231
tools_software_languages:
3332
- tinyML
33+
- Computer Vision
34+
- Edge AI Game
3435
- CNN
3536
- PyTorch
3637
- ExecuTorch
@@ -56,4 +57,4 @@ further_reading:
5657
weight: 1 # _index.md always has weight of 1 to order correctly
5758
layout: "learningpathall" # All files under learning paths have this same wrapper
5859
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
59-
---
60+
---

content/learning-paths/embedded-and-microcontrollers/training-inference-pytorch/env-setup-1.md

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,34 @@ weight: 2
66
layout: learningpathall
77
---
88

9-
## Overview
10-
In this course, you will learn how to train and run inference using a Tiny Sentiment Classifier. You'll deploy the model on the Arm Corstone-320 FVP for sentiment analysis.
9+
## Overview
10+
This learning path (LP) is a direct follow-up to the [Introduction to TinyML on Arm using PyTorch and ExecuTorch](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm) learning path. While the previous path introduced you to the core concepts and the toolchain, this one puts that knowledge into practice with a fun, real-world example. We will move from the simple ["Feedforward Neural Network"](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm/4-build-model) in the previous LP, to a more practical computer vision task: A tiny Rock-Paper-Scissors game, to demonstrate how these tools can be used to solve a tangible problem and run efficiently on Arm-based edge devices.
11+
12+
13+
We will train a lightweight CNN to classify images of the letters R, P, and S as "rock," "paper," or "scissors." The script uses a synthetic data renderer to create a large dataset of these images with various transformations and noise, eliminating the need for a massive real-world dataset.
14+
15+
### What is a Convolutional Neural Network (CNN)?
16+
A Convolutional Neural Network (CNN) is a type of deep neural network primarily used for analyzing visual imagery. Unlike traditional neural networks, CNNs are designed to process pixel data by using a mathematical operation called **convolution**. This allows them to automatically and adaptively learn spatial hierarchies of features from input images, from low-level features like edges and textures to high-level features like shapes and objects.
17+
18+
![Image of a convolutional neural network architecture](image.png)
19+
20+
Image of a convolutional neural network architecture : [Image credits](https://medium.com/@atul_86537/learning-ml-from-first-principles-c-linux-the-rick-and-morty-way-convolutional-neural-c76c3df511f4).
21+
22+
CNNs are the backbone of many modern computer vision applications, including:
23+
24+
- **Image Classification:** Identifying the main object in an image, like classifying a photo as a "cat" or "dog".
25+
- **Object Detection:** Locating specific objects within an image and drawing a box around them.
26+
- **Facial Recognition:** Identifying and verifying individuals based on their faces.
27+
28+
For our Rock-Paper-Scissors game, we'll use a tiny CNN to classify images of the letters R, P, and S as the corresponding hand gestures.
1129

12-
We will train a lightweight convolutional neural network (CNN)-based sentiment classifier using synthetic text data. This model is optimized for small devices, using embedding layers and 1D convolutions for efficient text classification.
1330

1431

1532
## Environment Setup
16-
Setup your development environment for TinyML by following the first 3 chapters of the [Introduction to TinyML on Arm using PyTorch and ExecuTorch](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm) Learning Path (LP).
33+
To get started, follow the first three chapters of the [Introduction to TinyML on Arm using PyTorch and ExecuTorch](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm) Learning Path. This will set up your development environment and install the necessary tools.
1734

1835

19-
If you just followed the LP above, you should already have your virtual environment activated. If not, activate it using:
36+
If you just followed the LP above, you should already have your virtual environment activated. If not, activate it using:
2037

2138
```console
2239
source $HOME/executorch-venv/bin/activate
@@ -26,8 +43,7 @@ The prompt of your terminal now has `(executorch-venv)` as a prefix to indicate
2643
Run the commands below to install the dependencies.
2744

2845
```bash
29-
pip install argparse json
46+
pip install argparse json numpy pillow torch
3047
```
31-
You are now ready to build the model
32-
48+
You are now ready to build the model.
3349

0 commit comments

Comments
 (0)