*แจ้งวันหยุด* ทางบริษัทจะปิดทำการวันที่ 22 และ 29 กรกฎาคม 67 ตามปฏิทินวันหยุดของไทย เพราะฉะนั้นออเดอร์จะทำการจัดส่งอีกครั้งในวันทำการถัดไป
Object Classification with Edge Impulse Using Raspberry Pi 4 and Camera Module

Object Classification with Edge Impulse Using Raspberry Pi 4 and Camera Module

Introduction

The primary emphasis of this project lies in object classification or recognition. This involves identifying various objects during the capturing process. To construct this, Edge Impulse functions as a machine learning platform, training Raspberry Pi 4 to recognise different object types when connected to a camera.

 

Hardware Components

  • Raspberry Pi 4 Model B 
  • 32GB microSD Card
  • Raspberry Pi Camera Module 3

 

Software Requirement

 

Project Development

 

Hardware Part

i. Connect the Raspberry Pi camera module to the camera port available on the Raspberry Pi 4 with a ribbon cable.

 

ii. For additional information regarding the connection, refer to this documentation.

iii. Set up your Raspberry Pi 4 device by connecting the mouse, keyboard as well as monitor to the Raspberry Pi 4.

 

Software Part

i. Flash the Raspberry Pi OS into the microSD card by choosing the Raspberry Pi 4 device and Raspberry Pi OS with Full Legacy 64-bits.

  

 

 

ii. After successfully flashing the Raspberry Pi OS into the microSD card, insert the SD card into the Raspberry Pi 4.

iii. Initialise your new Raspberry Pi OS by filling in several details on the setup page.

iv. If you haven't linked the Raspberry Pi 4 using a LAN cable, connect it to your WiFi network and click the 'Terminal' icon in the top bar of the Raspberry Pi.

v. Run the following commands in your terminal based on the sequence provided in the table below.

 

No.Command
1sudo apt update
2curl -sL https://deb.nodesource.com/setup_12.x | sudo bash -
3sudo apt install -y gcc g++ make build-essential nodejs sox gstreamer1.0-tools gstreamer1.0-plugins-good gstreamer1.0-plugins-base gstreamer1.0-plugins-base-apps
4npm config set user root && sudo npm install edge-impulse-linux -g --unsafe-perm

 

vi. Refer to the datasheet of the camera module and determine the model sensor type of the camera module you are using in the project.

 

vii. To interface your camera module into the Raspberry Pi, command this in the terminal:

sudo nano /boot/config.txt

 

viii. Add the command to the configuration text file depending on your model sensor type.

dtoverlay=imx708

 

 

(Because the sensor type is the Raspberry Pi camera module 3, specifically imx708, it is designated to the variable "dtoverlay.")

 

ix. Press “Ctrl + X” -> “Ctrl + Y” ->  “ ENTER” to save the edit.

x. Reboot your Raspberry Pi device.

 

Edge Impulse Part

i. Create a new project on your Edge Impulse.

ii. Open the terminal and enter the command below to enable the connection between Edge Impulse and Raspberry Pi.

edge-impulse-linux --clean

 

iii. Fill in the details and select the project you created on the Edge Impulse.

 

iv. Select your sensor type where the HDMI type is chosen.

 

v. The figure below shows the successful connection between the Raspberry Pi and Edge Impulse.

 

vi. Within Edge Impulse, there are five stages to be taken into account:

 

a. Device 

  • When the icon of Raspberry Pi turns from red colour to green colour, this indicates that the Raspberry Pi 4 device is successfully linked to the Edge Impulse.

 

b. Data Acquisition

  • The sensor type of camera is chosen from the list and the sample length can be adjusted on the same page.

  • When the “Start sampling” is clicked, the data for capturing objects from the camera module is recorded. For example, the data collection included “pikachu”, “USB” and “gamepad” in this case.

  • By changing the "label" of the data, the data type can be modified.

  • Then, the data collected is uploaded and saved to the same data acquisition page.

 

c. Impulse Design

  • Graphical representation, be it in a chart or table, requires setting up the impulse or feature first by selecting from the recommended list. For instance, create two block models: a processing block and a learning block, with one block allowed for each category. Remember to save the created impulse. 

 

  • Each created impulse must be accessed and trained independently.

 

      

 

d. Live Classification 

  • In the live classification category, users can verify data collected using the camera module to gather and classify test data by clicking "Start sampling". Be sure to label each test data with its expected outcome.

 

e. Model Testing

  • By clicking "Classify all", model testing characterises test data using graphical charts. After testing, observe the output through the provided chart.

 

vii. To run the building machine model locally, consider the command below.

edge-impulse-linux-runner

 

 

viii. The figure below illustrates the output in the terminal after entering the command mentioned above.

 

Tutorial Video

This tutorial video provides a clear illustration of the entire project development, showcasing an object recognition project that identifies various objects and delivers results in terms of the accuracy of object capturing.

อุปกรณ์ฮาร์ดแวร์


โพสต์ที่เกี่ยวข้อง

TinyML on Arduino using Edge Impulse

TinyML on Arduino using Edge Impulse

Edge Impulse is a platform that allows us to build projects related to machine learning on microcontrollers. This tutorial will be divided into a few parts, and we will update accordingly.....
Introduction to Edge Impulse

Introduction to Edge Impulse

Edge Impulse guides embedded machine learning, helping developers optimize solutions with real-world data. It speeds up deployment, benefiting various industries...
Voice Recognition with Edge Impulse Using Computer Application

Voice Recognition with Edge Impulse Using Computer Application

Edge Impulse empowers computer devices to function in their surroundings. In this setup, the computer serves as the primary tool for gathering data and deploying machine learning models...
Edge Impulse with Mobile Phone Application Using Accelerometer

Edge Impulse with Mobile Phone Application Using Accelerometer

Edge Impulse supports mobile devices, allowing the implementation of machine learning models directly on phones. This project emphasizes using the built-in accelerometer sensor in the phone...
Edge Impulse with Raspberry Pi Pico Application Using ADC Light Sensor

Edge Impulse with Raspberry Pi Pico Application Using ADC Light Sensor

Edge Impulse has the ability to interface with the Raspberry Pi Pico device, equipped with the RP2040 chip. In this project, data is gathered using the light sensor to measure light intensity...
Edge Impulse with Raspberry Pi Pico Application Using Ultrasonic Sensor

Edge Impulse with Raspberry Pi Pico Application Using Ultrasonic Sensor

Edge Impulse now supports devices with the RP2040 chip. The project uses the Raspberry Pi Pico with the RP2040 chip to create an ultrasonic ranger for distance measurement...
Object Detection with Edge Impulse Using Mobile Phone

Object Detection with Edge Impulse Using Mobile Phone

Edge Impulse enables the creation of an object detection project on a mobile device. Utilising the smartphone's camera, this project gathers data and constructs a machine learning model...