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

发布人是

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.

参阅相关产品

RASPBERRYPI4 4GB | 4 Model B

Raspberry Pi Foundation 嵌入式系统开发板和套件 查看

最新消息

Sorry, your filter selection returned no results.

请仔细阅读我们近期更改的隐私政策。当按下确认键时,您已了解并同意艾睿电子的隐私政策和用户协议。

本网站需使用cookies以改善用户您的体验并进一步改进我们的网站。此处阅读了解关于网站cookies的使用以及如何禁用cookies。网页cookies和追踪功能或許用于市场分析。当您按下同意按钮,您已经了解并同意在您的设备上接受cookies,并给予网站追踪权限。更多关于如何取消网站cookies及追踪的信息,请点击下方“阅读更多”。尽管同意启用cookies追踪与否取决用户意愿,取消网页cookies及追踪可能导致网站运作或显示异常,亦或导致相关推荐广告减少。

我们尊重您的隐私。请在此阅读我们的隐私政策。