ML Capability of Raspberry Pi Zero 2W

Table of contents

RoadTest: Raspberry Pi Zero 2W

Author: cbohra00627

Creation date:

Evaluation Type: Development Boards & Tools

Did you receive all parts the manufacturer stated would be included in the package?: True

What other parts do you consider comparable to this product?: The Zero2W worked almost comparable to the Raspberry Pi 4B in some cases where small size datasets were used and there was not much processing power required. In fact, I realised that the Zero2W was working more smoothly as compared to the Pi 4B generally. I felt that it was booting up faster.

What were the biggest problems encountered?: First of all, I got the kit very late. It was the courier's fault. They mistakenly dropped my package in another city. This delayed my roadtest by a few days. Second, the canakit power supply was not working. When I connected it to the board and turned on the supply, the led on the board started for an instant then automatically went off. Third, I encountered many errors while trying to run different packages of machine learning. Some of the packages are compatible with Buster only but I wanted to use Bullseye. Some other packages had other dependency problems.

Detailed Review:

Introduction:

Machine Learning is becoming more and more popular day by day. With this popularity, the demand of begin able to deploy ML on edge devices and development boards is also rising. But the problem is that these edge devices have very limited resources. They can't handle that much computations which are required by the ML Algorithms.

With a quad core processor, I expect the Pi Zero2W to perform better in this regard. In this roadtest, I will try to implement some ML areas on the Zero2W. This will be generally related to image and video processing.

Kit:

Thanks to E14, I received the following kit:

  • Raspberry Pi Zero 2W
  • Canakit 5V/2.5A power supply
  • 32 GB SD Card
  • Heat Sink

The Zero 2W is a quad core 64 bit ARM Cortex-A53 (clocked at 1GHz), 512MB SDRAM SBC. It is the successor of the Raspberry Pi Zero W which had only single core.

It has builtin WLAN and bluetooth module and supports HDMI output.

The board came with a canakit power supply. But it was not working. Whenever I connected it to the board, the green led blinked for an instant and then turned off. First, I tried to open it and repair it. But after getting two cuts on my hand during a brutal attempt of opening itSweat smile, I put it aside and used my power bank (max output 2.4A) instead as the power supply.

Initial Setup:

I accessed the board remotely (via ssh). I followed these steps to set it up.

  • I installed the latest Raspbian lite OS (64 bit Bullseye) on the board. (In order to make use of full potential of the board, I am using the Raspbian lite OS instead of Raspbian Desktop since that might require extra resources)
  • I installed Putty on my laptop and enabled X11 forwarding.
  • I installed Xming on the laptop to view any GUI application from the terminal, if required.
  • I installed WinSCP on the laptop to share files between the board and the laptop.

Implementing Machine Learning on the board:

I tested the board for ML in three areas:

  • Linear Regression - I tried to implement linear regression using the sklearn library. I saw that the board was showing weird behavior with large datasets. It was showing 'killed' while trying to load over 100MB sized dataset using pandas library. The error 'Killed' occurs when the system runs out of memory.
    • Datasets below 50 MB loaded and ran successfully.
    • Datasets between 50 MB and 100 MB loaded but ran with some programs while showed 'Killed' with some other programs.
    • Datasets over 100 MB didn't even load using pandas.read_csv().Thus, Zero2W can work with datasets of lower sizes. Large size datasets might not work on the board.

  • Text Recognition - I implemented text detection using Pytesseract and EAST Text Detector. With both, the board gave satisfactory results. With Pytesseract, the board can be used as a document reader but can read only printed text with clear background (preferably white). With the EAST Detector, the board can be used to detect text in natural scenes.Time taken by the board to read an printed application (using Tesseract OCR) - 16 secTime taken by the board to detect text in natural scenes (using EAST) - around 3 sec in every image

  • Facial Detection - I implemented facial detection using Opencv. I did image and video processing on the board. In case of image processing, the board gave satisfactory results. But in case of video processing, it took too much time just in drawing a single rectangle over faces in the video. It took around 154 sec just to draw a rectangle over a face in a 33 sec video. And took around 70 sec to draw rectangle around a group of people in a 8 sec video.

Note: - While writing these blogs, I realized that its still not easy to implement ML on embedded boards like the raspberry pi because many of the packages based on any area of ML are not updated continuously. They give dependency and version problems. Some of them work only on the Raspbian 'Buster'.

Its always preferable to write your own algorithm or code instead of using any prebuilt package (particularly for ML). I wasted a lot of time trying to find some workarounds for these packages but at last I ended up having to write code for my applications. These codes can be easily found online. Moreover, it is easier to solve any error in a single code file instead of a whole package.

Conclusion:

The raspberry pi Zero2W can be used for many ML applications provided the application doesn't demand much memory requirements. It can work with small size datasets and models.

The Zero2W works efficiently for image processing. But in case of video processing, it doesn't perform up to the expectations.

Anonymous