LogoLogo
HomeAPI & SDKsProjectsForumStudio
  • Getting started
    • For beginners
    • For ML practitioners
    • For embedded engineers
  • Frequently asked questions (FAQ)
  • Tutorials
    • End-to-end tutorials
      • Computer vision
        • Image classification
        • Object detection
          • Object detection with bounding boxes
          • Detect objects with centroid (FOMO)
        • Visual anomaly detection
        • Visual regression
      • Audio
        • Sound recognition
        • Keyword spotting
      • Time-series
        • Motion recognition + anomaly detection
        • Regression + anomaly detection
        • HR/HRV
        • Environmental (Sensor fusion)
    • Data
      • Data ingestion
        • Collecting image data from the Studio
        • Collecting image data with your mobile phone
        • Collecting image data with the OpenMV Cam H7 Plus
        • Using the Edge Impulse Python SDK to upload and download data
        • Trigger connected board data sampling
        • Ingest multi-labeled data using the API
      • Synthetic data
        • Generate audio datasets using Eleven Labs
        • Generate image datasets using Dall-E
        • Generate keyword spotting datasets using Google TTS
        • Generate physics simulation datasets using PyBullet
        • Generate timeseries data with MATLAB
      • Labeling
        • Label audio data using your existing models
        • Label image data using GPT-4o
      • Edge Impulse Datasets
    • Feature extraction
      • Building custom processing blocks
      • Sensor fusion using embeddings
    • Machine learning
      • Classification with multiple 2D input features
      • Visualize neural networks decisions with Grad-CAM
      • Sensor fusion using embeddings
      • FOMO self-attention
    • Inferencing & post-processing
      • Count objects using FOMO
      • Continuous audio sampling
      • Multi-impulse (C++)
      • Multi-impulse (Python)
    • Lifecycle management
      • CI/CD with GitHub Actions
      • Data aquisition from S3 object store - Golioth on AI
      • OTA model updates
        • with Arduino IDE (for ESP32)
        • with Arduino IoT Cloud
        • with Blues Wireless
        • with Docker on Allxon
        • with Docker on Balena
        • with Docker on NVIDIA Jetson
        • with Espressif IDF
        • with Nordic Thingy53 and the Edge Impulse app
        • with Particle Workbench
        • with Zephyr on Golioth
    • API examples
      • Customize the EON Tuner
      • Ingest multi-labeled data using the API
      • Python API bindings example
      • Running jobs using the API
      • Trigger connected board data sampling
    • Python SDK examples
      • Using the Edge Impulse Python SDK to run EON Tuner
      • Using the Edge Impulse Python SDK to upload and download data
      • Using the Edge Impulse Python SDK with Hugging Face
      • Using the Edge Impulse Python SDK with SageMaker Studio
      • Using the Edge Impulse Python SDK with TensorFlow and Keras
      • Using the Edge Impulse Python SDK with Weights & Biases
    • Expert network projects
  • Edge Impulse Studio
    • Organization hub
      • Users
      • Data campaigns
      • Data
        • Cloud data storage
      • Data pipelines
      • Data transformation
        • Transformation blocks
      • Upload portals
      • Custom blocks
        • Custom AI labeling blocks
        • Custom deployment blocks
        • Custom learning blocks
        • Custom processing blocks
        • Custom synthetic data blocks
        • Custom transformation blocks
      • Health reference design
        • Synchronizing clinical data with a bucket
        • Validating clinical data
        • Querying clinical data
        • Transforming clinical data
    • Project dashboard
      • Select AI hardware
    • Devices
    • Data acquisition
      • Uploader
      • Data explorer
      • Data sources
      • Synthetic data
      • Labeling queue
      • AI labeling
      • CSV Wizard (time-series)
      • Multi-label (time-series)
      • Tabular data (pre-processed & non-time-series)
      • Metadata
      • Auto-labeler | deprecated
    • Impulses
    • EON Tuner
      • Search space
    • Processing blocks
      • Audio MFCC
      • Audio MFE
      • Audio Syntiant
      • Flatten
      • HR/HRV features
      • Image
      • IMU Syntiant
      • Raw data
      • Spectral features
      • Spectrogram
      • Custom processing blocks
      • Feature explorer
    • Learning blocks
      • Anomaly detection (GMM)
      • Anomaly detection (K-means)
      • Classification
      • Classical ML
      • Object detection
        • MobileNetV2 SSD FPN
        • FOMO: Object detection for constrained devices
      • Object tracking
      • Regression
      • Transfer learning (images)
      • Transfer learning (keyword spotting)
      • Visual anomaly detection (FOMO-AD)
      • Custom learning blocks
      • Expert mode
      • NVIDIA TAO | deprecated
    • Retrain model
    • Live classification
    • Model testing
    • Performance calibration
    • Deployment
      • EON Compiler
      • Custom deployment blocks
    • Versioning
    • Bring your own model (BYOM)
    • File specifications
      • deployment-metadata.json
      • ei-metadata.json
      • ids.json
      • parameters.json
      • sample_id_details.json
      • train_input.json
  • Tools
    • API and SDK references
    • Edge Impulse CLI
      • Installation
      • Serial daemon
      • Uploader
      • Data forwarder
      • Impulse runner
      • Blocks
      • Himax flash tool
    • Edge Impulse for Linux
      • Linux Node.js SDK
      • Linux Go SDK
      • Linux C++ SDK
      • Linux Python SDK
      • Flex delegates
      • Rust Library
    • Rust Library
    • Edge Impulse Python SDK
  • Run inference
    • C++ library
      • As a generic C++ library
      • On Android
      • On your desktop computer
      • On your Alif Ensemble Series Device
      • On your Espressif ESP-EYE (ESP32) development board
      • On your Himax WE-I Plus
      • On your Raspberry Pi Pico (RP2040) development board
      • On your SiLabs Thunderboard Sense 2
      • On your Spresense by Sony development board
      • On your Syntiant TinyML Board
      • On your TI LaunchPad using GCC and the SimpleLink SDK
      • On your Zephyr-based Nordic Semiconductor development board
    • Arm Keil MDK CMSIS-PACK
    • Arduino library
      • Arduino IDE 1.18
    • Cube.MX CMSIS-PACK
    • Docker container
    • DRP-AI library
      • DRP-AI on your Renesas development board
      • DRP-AI TVM i8 on Renesas RZ/V2H
    • IAR library
    • Linux EIM executable
    • OpenMV
    • Particle library
    • Qualcomm IM SDK GStreamer
    • WebAssembly
      • Through WebAssembly (Node.js)
      • Through WebAssembly (browser)
    • Edge Impulse firmwares
    • Hardware specific tutorials
      • Image classification - Sony Spresense
      • Audio event detection with Particle boards
      • Motion recognition - Particle - Photon 2 & Boron
      • Motion recognition - RASynBoard
      • Motion recognition - Syntiant
      • Object detection - SiLabs xG24 Dev Kit
      • Sound recognition - TI LaunchXL
      • Keyword spotting - TI LaunchXL
      • Keyword spotting - Syntiant - RC Commands
      • Running NVIDIA TAO models on the Renesas RA8D1
      • Two cameras, two models - running multiple object detection models on the RZ/V2L
  • Edge AI Hardware
    • Overview
    • Production-ready
      • Advantech ICAM-540
      • Seeed SenseCAP A1101
      • Industry reference design - BrickML
    • MCU
      • Ambiq Apollo4 family of SoCs
      • Ambiq Apollo510
      • Arducam Pico4ML TinyML Dev Kit
      • Arduino Nano 33 BLE Sense
      • Arduino Nicla Sense ME
      • Arduino Nicla Vision
      • Arduino Portenta H7
      • Blues Wireless Swan
      • Espressif ESP-EYE
      • Himax WE-I Plus
      • Infineon CY8CKIT-062-BLE Pioneer Kit
      • Infineon CY8CKIT-062S2 Pioneer Kit
      • Nordic Semi nRF52840 DK
      • Nordic Semi nRF5340 DK
      • Nordic Semi nRF9160 DK
      • Nordic Semi nRF9161 DK
      • Nordic Semi nRF9151 DK
      • Nordic Semi nRF7002 DK
      • Nordic Semi Thingy:53
      • Nordic Semi Thingy:91
      • Open MV Cam H7 Plus
      • Particle Photon 2
      • Particle Boron
      • RAKwireless WisBlock
      • Raspberry Pi RP2040
      • Renesas CK-RA6M5 Cloud Kit
      • Renesas EK-RA8D1
      • Seeed Wio Terminal
      • Seeed XIAO nRF52840 Sense
      • Seeed XIAO ESP32 S3 Sense
      • SiLabs Thunderboard Sense 2
      • Sony's Spresense
      • ST B-L475E-IOT01A
      • TI CC1352P Launchpad
    • MCU + AI accelerators
      • Alif Ensemble
      • Arduino Nicla Voice
      • Avnet RASynBoard
      • Seeed Grove - Vision AI Module
      • Seeed Grove Vision AI Module V2 (WiseEye2)
      • Himax WiseEye2 Module and ISM Devboard
      • SiLabs xG24 Dev Kit
      • STMicroelectronics STM32N6570-DK
      • Synaptics Katana EVK
      • Syntiant Tiny ML Board
    • CPU
      • macOS
      • Linux x86_64
      • Raspberry Pi 4
      • Raspberry Pi 5
      • Texas Instruments SK-AM62
      • Microchip SAMA7G54
      • Renesas RZ/G2L
    • CPU + AI accelerators
      • AVNET RZBoard V2L
      • BrainChip AKD1000
      • i.MX 8M Plus EVK
      • Digi ConnectCore 93 Development Kit
      • MemryX MX3
      • MistyWest MistySOM RZ/V2L
      • Qualcomm Dragonwing RB3 Gen 2 Dev Kit
      • Renesas RZ/V2L
      • Renesas RZ/V2H
      • IMDT RZ/V2H
      • Texas Instruments SK-TDA4VM
      • Texas Instruments SK-AM62A-LP
      • Texas Instruments SK-AM68A
      • Thundercomm Rubik Pi 3
    • GPU
      • Advantech ICAM-540
      • NVIDIA Jetson
      • Seeed reComputer Jetson
    • Mobile phone
    • Porting guide
  • Integrations
    • Arduino Machine Learning Tools
    • AWS IoT Greengrass
    • Embedded IDEs - Open-CMSIS
    • NVIDIA Omniverse
    • Scailable
    • Weights & Biases
  • Tips & Tricks
    • Combining impulses
    • Increasing model performance
    • Optimizing compute time
    • Inference performance metrics
  • Concepts
    • Glossary
    • Course: Edge AI Fundamentals
      • Introduction to edge AI
      • What is edge computing?
      • What is machine learning (ML)?
      • What is edge AI?
      • How to choose an edge AI device
      • Edge AI lifecycle
      • What is edge MLOps?
      • What is Edge Impulse?
      • Case study: Izoelektro smart grid monitoring
      • Test and certification
    • Data engineering
      • Audio feature extraction
      • Motion feature extraction
    • Machine learning
      • Data augmentation
      • Evaluation metrics
      • Neural networks
        • Layers
        • Activation functions
        • Loss functions
        • Optimizers
          • Learned optimizer (VeLO)
        • Epochs
    • What is embedded ML, anyway?
    • What is edge machine learning (edge ML)?
Powered by GitBook
On this page
  • Two cameras, two models - running multiple object detection models on the RZ/V2L
  • Prerequisites
  • Example models
  • The node.js application
  • Setup and installation
  • Running the application
  • Running the application with WebServer
  • Conclusion

Was this helpful?

Export as PDF
  1. Run inference
  2. Hardware specific tutorials

Two cameras, two models - running multiple object detection models on the RZ/V2L

PreviousRunning NVIDIA TAO models on the Renesas RA8D1NextOverview

Last updated 5 months ago

Was this helpful?

Two cameras, two models - running multiple object detection models on the RZ/V2L

In this tutorial, you will learn how to run multiple cameras with multiple models simultaneously on the Renesas RZ/V2L microprocessor. The models used for this demo are:

  • YOLOv5 - Face detection using DRPAI acceleration

  • ResNet - Number recognition on AARCH64 (no acceleration)

Prerequisites

To follow this tutorial, you will need a combination of hardware and software tools. You will need an Edge Impulse compatible Renesas RZ board, either the Renesas RZ/V2L smarc board or the Avnet RZBoard. In addition to the board, the following additional items are needed:

  • Two webcams - the webcams used for this tutorial are:

    • Logitech C920 HD Pro Webcam

    • Logitech C922 Pro Stream 1080p Webcam

  • USB hub (to connect the cameras to the Renesas RZ/V2L board)

  • Ethernet cable or USB serial cable

Note that any webcams will suffice for this application. Some details will have to be modified depending on the cameras, this is explained in detail further along in the tutorial.

In order to successfully install and run the application, you need access to the target's Linux terminal. You may require other hardware like ethernet cable or USB to serial cable to achieve this. Detailed instructions on how to set the device up and gain access to the Linux are not provided here. For the Renesas RZ/V2L board, please refer to this page and for the Avnet RZBoard, please refer to this page.

Example models

unzip models-20230921T125858Z-001.zip

There are two folders in this zip file. The cpu directory contains a ResNet model that identifies numbers for a Linux aarch64 target without acceleration by the DRPAI. The drpai directory contains a YOLOv5 face detection model for the RZ/V2L microprocessor with DRPAI acceleration incorporated. Once the files have been extracted, their permissions need to be changed to make them executable. This can be done as follows:

chmod u+x models/drpai/face-detection-linux-aarch64-rzv2l-v33.eim
chmod u+x models/cpu/detect-numbers-resnet-linux-aarch64-v24.eim

The node.js application

Setup and installation

The application required to run the two models simultaneously must be downloaded from the Edge Impulse CLI repository. The simplest way to do this is to run the following command in your terminal/command line application:

wget https://github.com/edgeimpulse/edge-impulse-linux-cli/archive/refs/heads/classify-camera-finer-control.zip
unzip classify-camera-finer-control.zip
cd edge-impulse-linux-cli-classify-camera-finer-control
ls -l

While staying at the same directory, install the dependencies and build the application as follows:

npm install
npm run build

Please ensure that you are inside the directory edge-impulse-linux-cli-classify-camera-finer-control when installing and running the application.

Running the application

Before we can run the application, please ensure that the directory structure is as follows:

/home
│
├── edge-impulse-linux-cli-classify-camera-finer-control
│   ├── borc
│   ├── cli
│   ...
├── models
│   ├── drpai
│   │   └── face-detection-linux-aarch64-rzv2l-v33.eim
│   ├── cpu
│   │   └── detect-numbers-resnet-linux-aarch64-v24.eim
...

In the previous step, we installed an application called classify-camera. To run this app with two cameras and two separate models, the same app needs to be executed twice in two separate terminal instances with different cameras. The arguments required by the app are:

  • model - name of the model to executed in the current instance (required)

  • camera - the name of the camera to be used for the instance as detected by the system (required)

  • fps - frames per second of the input stream. This will affect the speed of the app (default: 5)

  • width - the width of the input image directed to the respective model (default: 640)

  • height - the height of the input image directed to the respective model (default: 480)

The syntax of the command to be executed is as follows:

node build/examples/ts/classify-camera.js path_to_model name_of_webcam fps_value image_width image_height

Before running the first instance, we first need to determine the names of the webcam(s) that are detected by the system. The correct name is required to direct the stream from camera to the respective models. The easiest way to do this is by running the command with only the model as an argument. In this case:

cd edge-impulse-linux-cli-classify-camera-finer-control/
node build/examples/ts/classify-camera.js ../models/drpai/face-detection-linux-aarch64-rzv2l-v33.eim

The command will fail and result in an error with the error message containing names of the connecting cameras. In this case, the output might be as follows:

Starting the image classifier for Renesas / Face Detection (v34)
Parameters image size 320x320 px (3 channels) classes [ 'face' ]
[GST] checking for /etc/os-release
Error: Multiple cameras found ("HD Pro Webcam C920", "C922 Pro Stream Webcam"), add the camera to use to this script (node classify-camera.js model.eim cameraname)
    at /home/root/classify-camera-finer-control/build/examples/ts/classify-camera.js:43:19

From this output, we can determine that the names of cameras detected by the system are "HD Pro Webcam C920" and "C922 Pro Stream Webcam". These names can now be used to run the application. Before running the application, ensure that your current working directory is correct - it needs to be the edge-impulse-linux-cli-classify-camera-finer-control folder. In this case, the cd commands from the following instructions can be omitted.

You will need to open two terminal instances.

In terminal 1 run the following command:

cd edge-impulse-linux-cli-classify-camera-finer-control/
node build/examples/ts/classify-camera.js ../models/drpai/face-detection-linux-aarch64-rzv2l-v33.eim "HD Pro Webcam C920" 5 320 320

And in terminal 2 run the following command:

cd edge-impulse-linux-cli-classify-camera-finer-control/
node build/examples/ts/classify-camera.js ../models/cpu/detect-numbers-resnet-linux-aarch64-v24.eim "C922 Pro Stream Webcam" 5 240 240

Once both these commands have been executed, you will be able to see the results of the models in the terminal similar to the following in terminal 1:

Starting the image classifier for Renesas / Face Detection (v34)
Parameters image size 320x320 px (3 channels) classes [ 'face' ]
[GST] checking for /etc/os-release
Using camera HD Pro Webcam C920 starting...
Connected to camera
boundingBoxes 9ms. []
boundingBoxes 8ms. []
boundingBoxes 8ms. []
boundingBoxes 8ms. []
boundingBoxes 8ms. []
...

and the following in terminal 2:

Starting the image classifier for Renesas / Detect numbers Resnet (v24)
Parameters image size 224x224 px (3 channels) classes [
  '0', '1', '2', '3',
  '4', '5', '6', '7',
  '8', '9'
]
[GST] checking for /etc/os-release
Using camera C922 Pro Stream Webcam starting...
Connected to camera
classification 1672ms. {
  '0': '0.1046',
  '1': '0.3136',
  '2': '0.3120',
  '3': '0.0294',
  '4': '0.0185',
  '5': '0.0056',
  '6': '0.0084',
  '7': '0.1623',
  '8': '0.0071',
  '9': '0.0385'
}

Running the application in this way will not provide a visual output. To see a visual result of this inference, please see the following section.

Running the application with WebServer

The above steps are enough to execute both models and see their outputs in the terminal. However, it is always better to see a visual output of the image detection models that are being executing. With a slight modification of the execution commands, it is possible to run the application using WebServer and see the visual output.

The arguments to run the application using WebServer are as follows:

  • model - name of the model to executed in the current instance (required)

  • camera - the name of the camera to be used for the instance as detected by the system (required)

  • fps - frames per second of the input stream. This will affect the speed of the app (default: 5)

  • width - the width of the input image directed to the respective model (default: 640)

  • height - the height of the input image directed to the respective model (default: 480)

  • port - this is the port to which the output from the cameras and application is directed (default: 4912)

The syntax of the command to be executed is then changed to the following:

node build/examples/ts/classify-camera-webserver.js path_to_model name_of_webcam fps_value image_width image_height port

Similar to running the application before, you will need to open two terminal instances.

In terminal 1 run the following command:

cd edge-impulse-linux-cli-classify-camera-finer-control/
node build/examples/ts/classify-camera-webserver.js ../models/drpai/face-detection-linux-aarch64-rzv2l-v33.eim "HD Pro Webcam C920" 5 320 320 4912

The terminal output from this command will be:

Starting the image classifier for Renesas / Face Detection (v34)
Parameters image size 320x320 px (3 channels) classes [ 'face' ]
[GST] checking for /etc/os-release
Using camera HD Pro Webcam C920 starting...
Connected to camera

Want to see a feed of the camera and live classification in your browser? Go to http://192.168.178.30:4912

boundingBoxes 9ms. []
boundingBoxes 8ms. []
boundingBoxes 8ms. []
boundingBoxes 8ms. []
boundingBoxes 8ms. []
...

Navigating to the address mentioned in the output (http://192.168.178.30:4912 in this case), you will see an output similar to this:

In terminal 2 run the following command:

cd edge-impulse-linux-cli-classify-camera-finer-control/
node build/examples/ts/classify-camera-webserver.js ../models/cpu/detect-numbers-resnet-linux-aarch64-v24.eim "C922 Pro Stream Webcam" 5 240 240 4913

The terminal output from this command will be:

Starting the image classifier for Renesas / Detect numbers Resnet (v24)
Parameters image size 224x224 px (3 channels) classes [
  '0', '1', '2', '3',
  '4', '5', '6', '7',
  '8', '9'
]
[GST] checking for /etc/os-release
Using camera C922 Pro Stream Webcam starting...
Connected to camera

Want to see a feed of the camera and live classification in your browser? Go to http://192.168.178.30:4913

classification 1672ms. {
  '0': '0.1046',
  '1': '0.3136',
  '2': '0.3120',
  '3': '0.0294',
  '4': '0.0185',
  '5': '0.0056',
  '6': '0.0084',
  '7': '0.1623',
  '8': '0.0071',
  '9': '0.0385'
}

Note that the port numbers passed as arguments must be different. This allows for the streams to be directed to different ports to be viewed in the browser.

Navigating to the address mentioned in the output (http://192.168.178.30:4912 in this case), you will see an output similar to this:

Now you have two models running simultaneously. You will notice that the model running on the CPU has a significantly higher inference time (above 1200ms) as opposed to the model running on the DRP-AI (under 10ms). You can see a side by side view of this parallelism:

You can see the two models running simultaneously in the video below:

Conclusion

Congratulations! You have successfully run two Edge Impulse generated models simultaneously on the Renesas RZ/V2L device. You will notice that the model run using the DRP-AI accelerator is orders of magnitude faster than the one running simply on the CPU.

The possibilities are endless, and we can't wait to see what you'll build! 🚀

The models used for this tutorial can be downloaded as a zip file from this . The file (models-20230921T125858Z-001.zip) that you download, may be named differently for you. Once the file has been downloaded, go ahead and unzip the files either in the GUI or as follows:

If you would like to do it manually, it can be downloaded at the branch classify-camera-finer-control, at commit number: 1fc1639acdfb9e7af3fc8794619334b28dffac00. Once the application has been downloaded, unzip the contents, navigate to the directory and list the contents to ensure the operation was successful. This can be done as follows:

Using this application, you can run any two image-based models simultaneously on the RZV2L device. If you have a great idea for a different project, that's fine too. Edge Impulse lets you capture data from any sensor, build to extract features, and you have full flexibility in your Machine Learning pipeline with the learning blocks.

link
here
custom processing blocks
Overview of running multiple object detection models on RZ/V2L
Face detection with bounding box using DRP-AI
Number detection on CPU.
Simultaneous execution of two models.