Skip to content

Commit 1d69865

Browse files
authored
Merge pull request #2339 from annietllnd/review
Tech review of training-inference-pytorch
2 parents 4a03a28 + dedb844 commit 1d69865

File tree

7 files changed

+556
-343
lines changed

7 files changed

+556
-343
lines changed

content/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm/2-env-setup.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ From within the Python virtual environment, run the commands below to download t
4444
cd $HOME
4545
git clone https://github.com/pytorch/executorch.git
4646
cd executorch
47+
git checkout 188312844ebfb499f92ab5a02137ed1a4abca782
4748
```
4849

4950
Run the commands below to set up the ExecuTorch internal dependencies:
@@ -70,7 +71,7 @@ pip list | grep executorch
7071
```
7172

7273
```output
73-
executorch 0.6.0a0+3eea1f1
74+
executorch 1.1.0a0+1883128
7475
```
7576

7677
## Next Steps

content/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm/3-env-setup-fvp.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ The Corstone reference system is provided free of charge, although you will have
1616

1717
## Corstone-320 FVP Setup for ExecuTorch
1818

19-
Navigate to the Arm examples directory in the ExecuTorch repository. Run the following command.
19+
Run the FVP setup script in the ExecuTorch repository.
2020

2121
```bash
22-
cd $HOME/executorch/examples/arm
23-
./setup.sh --i-agree-to-the-contained-eula
22+
cd $HOME/executorch
23+
./examples/arm/setup.sh --i-agree-to-the-contained-eula
2424
```
2525

2626
After the script has finished running, it prints a command to run to finalize the installation. This step adds the FVP executables to your system path.
Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,43 @@
11
---
2-
title: Edge AI with PyTorch & ExecuTorch - Tiny Sentiment Analysis on Arm
2+
title: Edge AI with PyTorch & ExecuTorch - Tiny Rock-Paper-Scissors on Arm
33

4-
draft: true
5-
cascade:
6-
draft: true
4+
minutes_to_complete: 60
75

8-
minutes_to_complete: 90
6+
who_is_this_for: This learning path is for machine learning developers 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. You'll use PyTorch and ExecuTorch, frameworks designed for efficient on-device inference, to build and run a small-scale computer vision model.
97

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.
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.
1614

17-
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.
21-
- A Linux host machine or VM running Ubuntu 22.04 or higher.
22-
- An Arm license to run the examples on the Corstone-320 Fixed Virtual Platform (FVP), for hands-on deployment.
2315

16+
prerequisites:
17+
- A basic understanding of machine learning concepts.
18+
- Familiarity with Python and the PyTorch library.
19+
- Having completed [Introduction to TinyML on Arm using PyTorch and ExecuTorch](/learning-paths/embedded-and-microcontrollers/introduction-to-tinyml-on-arm).
20+
- An x86 Linux host machine or VM running Ubuntu 22.04 or higher.
2421

2522
author: Dominica Abena O. Amanfo
2623

2724
### Tags
2825
skilllevels: Introductory
2926
subjects: ML
3027
armips:
31-
- Cortex-A
28+
- Cortex-M
29+
- Ethos-U
3230
tools_software_languages:
3331
- tinyML
32+
- Computer Vision
33+
- Edge AI
3434
- CNN
3535
- PyTorch
3636
- ExecuTorch
3737

3838
operatingsystems:
3939
- Linux
4040

41-
4241
further_reading:
4342
- resource:
4443
title: Run Llama 3 on a Raspberry Pi 5 using ExecuTorch
@@ -56,4 +55,4 @@ further_reading:
5655
weight: 1 # _index.md always has weight of 1 to order correctly
5756
layout: "learningpathall" # All files under learning paths have this same wrapper
5857
learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content.
59-
---
58+
---

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

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,31 @@ 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 one introduced you to the core concepts and the toolchain, this one puts that knowledge into practice with a fun, real-world example. You 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.
1111

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.
12+
You 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.
1313

14+
### What is a Convolutional Neural Network (CNN)?
15+
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.
1416

15-
## 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).
17+
![Image of a convolutional neural network architecture](image.png)
18+
[Image credits](https://medium.com/@atul_86537/learning-ml-from-first-principles-c-linux-the-rick-and-morty-way-convolutional-neural-c76c3df511f4).
19+
20+
CNNs are the backbone of many modern computer vision applications, including:
21+
22+
- **Image Classification:** Identifying the main object in an image, like classifying a photo as a "cat" or "dog".
23+
- **Object Detection:** Locating specific objects within an image and drawing a box around them.
24+
- **Facial Recognition:** Identifying and verifying individuals based on their faces.
25+
26+
For the Rock-Paper-Scissors game, you'll use a tiny CNN to classify images of the letters R, P, and S as the corresponding hand gestures.
1727

1828

19-
If you just followed the LP above, you should already have your virtual environment activated. If not, activate it using:
29+
30+
## Environment Setup
31+
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. Return to this LP once you've run the `./examples/arm/run.sh` script in the ExecuTorch repository.
32+
33+
If you just followed the LP above, you should already have your virtual environment activated. If not, activate it using:
2034

2135
```console
2236
source $HOME/executorch-venv/bin/activate
@@ -26,8 +40,7 @@ The prompt of your terminal now has `(executorch-venv)` as a prefix to indicate
2640
Run the commands below to install the dependencies.
2741

2842
```bash
29-
pip install argparse json
43+
pip install argparse numpy pillow torch
3044
```
31-
You are now ready to build the model
32-
45+
You are now ready to create the model.
3346

0 commit comments

Comments
 (0)