Raspberry Pi Image Recognition: Raspberry Pi 3B+ vs 4 Speed Test

Published By

The Raspberry Pi board is a fabulous device, functioning as an actual computer with a price tag of just $35. Up until the recently announced Raspberry Pi 4's debut, one thing holding it back was its lack of a USB 3.0 port.

Raspberry Pi 3B+ vs. 4

Adding a USB 3.0 port takes the Pi's theoretical data transfer rate from 480 Mbps to 5 Gbps, a data throughput increase of over 10x. The Raspberry Pi 4 features two USB 3.0 ports along with a pair of 2.0 ports for less data-intensive tasks. For some applications, this port update could be reason enough to upgrade, though the new model also features increased process speed and more available RAM.

I considered how these upgrades could affect my projects, especially applications that involve an accelerator, such as Google's Coral Edge TPU. The idea came from one of my previous applications, where bird identification reportedly takes about three seconds, supposedly held back by the USB 2.0 speeds. The project uses a Zero W, which isn't the most powerful Pi available.

I decided to focus my experiment on running image ID on the Pi 3B+ versus the Pi 4. Keep in mind that the Pi 4 has two to four times more powerful processing power.

So let's see how these two stack up against one another. My initial guess was that the speed increase wouldn't reach 10x, but that it would exceed the 4x speed increase you might expect from the ratio between the devices' processing capabilities. As it turns out, I was very wrong, at least for this parrot-ID demo.

Trial 1: Edge TPU on the Raspberry Pi 4

First, I attempted to install the TPU software on the Raspberry Pi 4 per Google's instructions, but I received an error message stating that my system wasn't supported. It turns out that supported devices only include Pi 2 and 3 B/B+. While there's a workaround for Raspbian Buster, which I was running on the Pi 4, I still wasn't immediately able to get the software working correctly. Next, I tried the procedure with a 3B+, which succeeded and let me run a demo, identifying the scarlet macaw in 4.4 seconds.

The next question was: would the TPU software work on the Pi 4? Yes! The system identified the right bird using a 3.0 port in 3.6 seconds, and four seconds using one of the Pi 4's 2.0 ports.

The identification speed, while noticeable, wasn't nearly as dramatic as I'd expected. The question remains whether using the B+ for a roundabout installation threw things off. I did find it interesting that the performance jump was .4 seconds when using a 2.0 port, and another .4 seconds when using the 3.0 port. This would imply that the 2.0 port is only part of the bottleneck here, with the Pi's speed contributing to the speed increase as well.

Trial 2:Using a Pre-Compiled RPi 4 Disk Image

To examine whether installation on the Pi 3+ somehow throttled the Pi 4, I used a pre-compiled Raspberry Pi 4 disk image from the EdgeTPU GitHub page. The page is quick to note that it's not an officially supported product, but I figured it was worth a try. Here's the process:

1. Flash the card using the balenaEtcher tool.

2. Download the model, labels file, and photo as outlined in the getting started page under "Run a model on the Edge TPU."

3. Navigate to the demo directory for Python 3.7 using: "cd /usr/local/lib/python3.7/dist-packages/edgetpu/demo" incantation.

4. Finally, run the "classify_image" routine on the demo macaw.

Here are the results I received:

- USB 2.0: 4.0 seconds

- USB 3.0: 3.5 seconds

While this process might offer results a tenth of a second faster than the previous Pi 4 run, the difference could also be due to user error when using a timer. I'm also not certain that I enabled maximum frequency the first time around—and I don't know how the precompiled disk image handles maximum frequency anyway. Based on those two factors, I can't observe a clear difference between this not-quite-official image and my Pi 4 run hacked together with a Pi 3B+.

Conclusion: Raspberry Pi 4 Image Recognition Speed

As it stands, swapping from a 3B+ to a Pi4 with a USB 3.0 port will save you up to .9 seconds when running the scarlet macaw identification demo. A time savings of 20% may be helpful for your application, but it's not the dramatic result I was expecting. On the other hand, in real-world scenarios with repeated image classifications, or other processing tasks, using the Pi 4 could make a huge difference.

See related product

RASPBERRYPI4 4GB | 4 Model B

Raspberry Pi Foundation Embedded System Development Boards and Kits View

Latest News

Sorry, your filter selection returned no results.

We've updated our privacy policy. Please take a moment to review these changes. By clicking I Agree to Arrow Electronics Terms Of Use  and have read and understand the Privacy Policy and Cookie Policy.

Our website places cookies on your device to improve your experience and to improve our site. Read more about the cookies we use and how to disable them here. Cookies and tracking technologies may be used for marketing purposes.
By clicking “Accept”, you are consenting to placement of cookies on your device and to our use of tracking technologies. Click “Read More” below for more information and instructions on how to disable cookies and tracking technologies. While acceptance of cookies and tracking technologies is voluntary, disabling them may result in the website not working properly, and certain advertisements may be less relevant to you.
We respect your privacy. Read our privacy policy here