Hands-On Computer Vision
ICTP-UNU Workshop on TinyML
for Sustainable Development
1
2
Step1:
* Preparation
* Data Collection
Step2:�* Training Design Model
Main Content
3
Step3:�* Test & Deploy
Your model
Introduction to Machine Vision
0
Main Content
Introduction to Machine Vision
0
Introduction to Machine Vision
Introduction to Machine Vision
Introduction to Machine Vision
Introduction to Machine Vision
Introduction to Machine Vision
Introduction to Machine Vision
A greyscale image can be understood as consisting of dark (0) and light (numbers greater than zero), the closer to 255 means the brighter the area is.
Introduction to Machine Vision
Introduction to Machine Vision
Shape 3D Array (480*540*3)
Height
Width
Colour Channel
Introduction to Machine Vision
Introduction to Machine Vision
Introduction to Machine Vision
Introduction to Machine Vision
Introduction to Machine Vision
Convolutional Layers
Introduction to Machine Vision
Pooling Layers
Introduction to Machine Vision
Fully Connected Layers
Image Classification VS Object Detection
Image Classification
Image Classification VS Object Detection
Object Detection
Image Classification VS Object Detection
Key Differences
Summary
Main Content
1
Step1:
* Preparation
* Data Collection
Introduction to Machine Vision
0
Step 1.1.1 Before Preparation
Step 1.1.2 Environment Preparation
1. Open the Arduino IDE.
2. Go to File > Preferences.
3. In the "Additional Boards Manager URLs" field, enter the following URL:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
4. Click "OK" to close the Preferences window.
Step 1.1.3 Install XIAO ESP32S3 on Arduino IDE
5. Navigate to Tools > Board > Boards Manager.
6. In the Boards Manager window, search for "ESP32".
7. Locate the "ESP32 by Espressif Systems" entry and click on it.
8. Select the latest version from the dropdown menu and click "Install".
9. Wait for the installation process to complete. This may take a few minutes.
10. Once the installation is finished, close the Boards Manager window.
Step 1.1.3 Install XIAO ESP32S3 on Arduino IDE
2. Define the XIAO model pins:
#define CAMERA_MODEL_XIAO_ESP32S3 // Has PSRAM
3. And on Tools, enable the PSRAM. Enter your WiFi credentials and upload the code to the device:
4 . Copy the address on the Serial Monitor.
Step 1.2.1 Open the dataset collection progress
5. Open the webpage and click “start stream”
6. Save the photo with what you want to detect.
*********
We suggest around 50 images mixing the objects and varying the number of each appearing on the scene. Try to capture different angles, backgrounds, and light conditions.
The stored images use a QVGA frame size of 320x240 and RGB565 (color pixel format).
Step 1.2.2 Dataset Collection via XIAO ESP32S3
Main Content
1
2
Step1:
* Preparation
* Data Collection
Step2:�* Training Design Model
Introduction to Machine Vision
0
Step 2.1 Setup the Edge Impulse Project
2. Create a new account then login.
3. Create a new project then name it.
“XIAO-ESP32S3-Sense-Object_Detection”
Step 2.1 Setup the Platform Dashboard
On your Project Dashboard, go down and on Project info
Select bounding boxes (object detection)
Then select Espressif ESP-EYE (most similar to our board) as your Target Device.
Step 2.2 Uploading the unlabeled data
1. On Studio, go to the Data Acquisition tab, and upload files captured as a folder from your computer on the UPLOAD DATA section.
2. All the not-labeled images (47) were uploaded but must be labeled appropriately before being used as a project dataset.
Step 2.3 Labeling the Dataset
Step 2.4 The Impulse Design Setup
1. Pre-processing consists of resizing the individual images from 320 x 240 to 96 x 96 and squashing them (squared form, without cropping). Afterward, the images are converted from RGB to Grayscale.
2. Design a Model, in this case, “Object Detection.”
Step 2.5 Preprocessing all dataset
1. In this section, select Color depth as Grayscale, suitable for use with FOMO models and Save parameters.
Step 2.6 Model Design and Training
1. Use FOMO, an object detection model based on MobileNetV2 (alpha 0.35) designed to coarsely segment an image into a grid of background vs objects of interest (here, boxes and wheels).
2. Regarding the training hyper-parameters, the model will be trained with:
Epochs: 60
Batch size: 32
Learning Rate: 0.001.
About FOMO
FOMO is an innovative machine learning model for object detection that uses up to 30 times less energy and memory than traditional models like Mobilenet SSD and YOLOv5.
It can operate on microcontrollers with less than 200 KB of RAM by focusing on object location rather than size.
How FOMO Works?
Main Content
1
2
Step1:
* Preparation
* Data Collection
Step2:�* Training Design Model
3
Step3:�* Test & Deploy
Your model
Introduction to Machine Vision
0
Step 3.1 Test your Model
1. Once our model is trained, we can test it using the Live Classification tool. On the correspondent section, click on the Connect a development board icon (a small MCU) and scan the QR code with your phone.
2. Once connected, you can use the smartphone to capture actual images to be tested by the trained model on Edge Impulse Studio.
3. One thing to be noted is that the model can produce false positives and negatives. This can be minimized by defining a proper Confidence Threshold (use the Three dots menu for the setup). Try with 0.8 or more.
Step 3.1 Output the Model
Step 3.2 Import model into Arduino IDE
Step 3.4 Change the setting on XIAO ESP32S3
Setting the XIAO ESP32 Pin set.
change lines 32 to 75, which define the camera model and pins, using the data related to our model. Copy and paste the below lines, replacing the lines 32-75:
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 10
#define SIOD_GPIO_NUM 40
#define SIOC_GPIO_NUM 39
#define Y9_GPIO_NUM 48
#define Y8_GPIO_NUM 11
#define Y7_GPIO_NUM 12
#define Y6_GPIO_NUM 14
#define Y5_GPIO_NUM 16
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 17
#define Y2_GPIO_NUM 15
#define VSYNC_GPIO_NUM 38
#define HREF_GPIO_NUM 47
#define PCLK_GPIO_NUM 13
Step 3.5 Deploy the Model on XIAO ESP32S3
Thanks you!
Let’s see who achieve first!
Congratulations!
Co-Create Gadget
Co-Invent Solutions
Based on various digital transformation scenarios, we continue to develop smart devices that integrate the latest technologies, and work closely with developers and industry experts to provide software and hardware solutions for vertical industries at multiple levels.
IoT Devices
Solution
Industrial Know-How
Smart Agriculture
Smart Greenhouse
Energy Monitoring
Carbon Monitoring
Smart
City
Smart
Traffic
Software, Algothrim, Industrial Insights
Non-engineer Experts
Embodied AI as a bridge between science and application
Make Profit From Your Ideas with Co-Create