วันพฤหัสบดีที่ 25 มกราคม พ.ศ. 2567

Raspberry pi5 TensorFlow-lite Object Detection

Raspberry pi5 TensorFlow-lite Object Detection

Hardware : Raspberry pi5

Specification
  • Broadcom BCM2712 2.4GHz quad-core 64-bit Arm Cortex-A76 CPU, with cryptography extensions, 512KB per-core L2 caches and a 2MB shared L3 cache
  • VideoCore VII GPU, supporting OpenGL ES 3.1, Vulkan 1.2
  • Dual 4Kp60 HDMI® display output with HDR support
  • 4Kp60 HEVC decoder
  • LPDDR4X-4267 SDRAM (4GB and 8GB SKUs available at launch)
  • Dual-band 802.11ac Wi-Fi®
  • Bluetooth 5.0 / Bluetooth Low Energy (BLE)
  • microSD card slot, with support for high-speed SDR104 mode
  • 2 × USB 3.0 ports, supporting simultaneous 5Gbps operation
  • 2 × USB 2.0 ports
  • Gigabit Ethernet, with PoE+ support (requires separate PoE+ HAT)
  • 2 × 4-lane MIPI camera/display transceivers
  • PCIe 2.0 x1 interface for fast peripherals (requires separate M.2 HAT or other adapter)
  • 5V/5A DC power via USB-C, with Power Delivery support
  • Raspberry Pi standard 40-pin header
  • Real-time clock (RTC), powered from external battery
  • Power button


Software 

Raspberry pi OS : 64 bit 

tflite-support


The new Raspberry Pi OS uses Python 3.11 by default, but TensorFlow Lite currently only supports Python 3.9 on ARM aarch64 architecture. To resolve this, you can create a separate virtual environment with Python 3.8 or 3.9 using

conda create -n name python=3.8 or conda create -n name python=3.9


Conda Python 3.8

Install mini conda

https://docs.conda.io/projects/miniconda/en/latest/miniconda-other-installer-links.html


conda create -n tflite python=3.8.18
conda activate tflite


TensorFlow-lite Example


Install Code

git clone https://github.com/tensorflow/examples --depth 1
cd examples/lite/examples/object_detection/raspberry_pi
sh setup.sh

Run Image Object Detection


Run Video File Object Detection


Source Code

https://github.com/tensorflow/examples/tree/master/lite/examples/object_detection/raspberry_pi










Adun Nantakaew อดุลย์ นันทะแก้ว 081-6452400
LINE : adunnan

วันอังคารที่ 16 มกราคม พ.ศ. 2567

Raspberry pi5 Yolov8 Object Detection

 Raspberry pi5 Yolov8 Object Detection


YOLOv8 from Ultralytics

Ultralytics YOLOv8 is a cutting-edge, state-of-the-art (SOTA) model that builds upon the success of previous YOLO versions and introduces new features and improvements to further boost performance and flexibility. YOLOv8 is designed to be fast, accurate, and easy to use, making it an excellent choice for a wide range of object detection and tracking, instance segmentation, image classification and pose estimation tasks.

Raspberry pi 5

Specification
  • Broadcom BCM2712 2.4GHz quad-core 64-bit Arm Cortex-A76 CPU, with cryptography extensions, 512KB per-core L2 caches and a 2MB shared L3 cache
  • VideoCore VII GPU, supporting OpenGL ES 3.1, Vulkan 1.2
  • Dual 4Kp60 HDMI® display output with HDR support
  • 4Kp60 HEVC decoder
  • LPDDR4X-4267 SDRAM (4GB and 8GB SKUs available at launch)
  • Dual-band 802.11ac Wi-Fi®
  • Bluetooth 5.0 / Bluetooth Low Energy (BLE)
  • microSD card slot, with support for high-speed SDR104 mode
  • 2 × USB 3.0 ports, supporting simultaneous 5Gbps operation
  • 2 × USB 2.0 ports
  • Gigabit Ethernet, with PoE+ support (requires separate PoE+ HAT)
  • 2 × 4-lane MIPI camera/display transceivers
  • PCIe 2.0 x1 interface for fast peripherals (requires separate M.2 HAT or other adapter)
  • 5V/5A DC power via USB-C, with Power Delivery support
  • Raspberry Pi standard 40-pin header
  • Real-time clock (RTC), powered from external battery
  • Power button

Raspberry Pi 3, 4, and 5 compare

FeatureRaspberry Pi 3Raspberry Pi 4Raspberry Pi 5
CPU1.2GHz Quad-Core ARM Cortex-A531.5GHz Quad-core 64-bit ARM Cortex-A722.4GHz Quad-core 64-bit Arm Cortex-A76
RAM1GB LPDDR22GB, 4GB or 8GB LPDDR4Details not yet available
USB Ports4 x USB 2.02 x USB 2.0, 2 x USB 3.02 x USB 3.0, 2 x USB 2.0
NetworkEthernet & Wi-Fi 802.11nGigabit Ethernet & Wi-Fi 802.11acGigabit Ethernet with PoE+ support, Dual-band 802.11ac Wi-Fi®
PerformanceSlower, may require lighter YOLO modelsFaster, can run complex YOLO modelsDetails not yet available
Power Requirement2.5A power supply3.0A USB-C power supplyDetails not yet available
Official DocumentationLinkLinkLink

Raspberry pi OS


Install Library

Pip install the ultralytics package including all requirements in a Python>=3.8 environment with PyTorch>=1.8.

PyPI version Downloads

pip install ultralytics

Run Test Image with Command Line

YOLOv8 may be used directly in the Command Line Interface (CLI) with a yolo command:

yolo predict model=yolov8n.pt source='https://ultralytics.com/images/bus.jpg'



Run Video File

yolo predict model=yolov8n.pt source=/home/pi/Video/your_video.mp4 show=True










Reference

Quick Start Guide: Raspberry Pi and Pi Camera with YOLOv5 and YOLOv8

https://docs.ultralytics.com/guides/raspberry-pi/#choose-your-yolo-version-yolov5-or-yolov8








Adun Nantakaew อดุลย์ นันทะแก้ว 081-6452400
LINE : adunnan