Raspberry Pi에서 Ultralytics YOLO26을 구동하는 Coral Edge TPU 🚀

Raspberry Pi with Edge TPU accelerator

Coral Edge TPU란 무엇입니까?

Coral Edge TPU는 시스템에 Edge TPU 보조 프로세서를 추가하는 소형 장치입니다. 이 장치는 TensorFlow Lite 모델을 위한 저전력, 고성능 ML 추론을 가능하게 합니다. 자세한 내용은 Coral Edge TPU 홈페이지에서 확인하십시오.



Watch: How to Run Inference on Raspberry Pi using Google Coral Edge TPU

Coral Edge TPU로 Raspberry Pi 모델 성능 향상하기

많은 사용자가 전력 효율성이 뛰어나고 다양한 애플리케이션에 사용할 수 있는 Raspberry Pi와 같은 임베디드 또는 모바일 장치에서 모델을 실행하고자 합니다. 그러나 ONNXOpenVINO와 같은 형식을 사용하더라도 이러한 장치에서의 추론 성능은 보통 저조합니다. Coral Edge TPU는 이 문제를 해결할 수 있는 훌륭한 솔루션으로, Raspberry Pi와 함께 사용하여 추론 성능을 크게 가속화할 수 있습니다.

TensorFlow Lite를 이용한 Raspberry Pi의 Edge TPU (신규)⭐

Raspberry Pi에서 Edge TPU를 사용하는 방법에 대한 Coral의 기존 가이드는 오래되었으며, 현재 Coral Edge TPU 런타임 빌드는 더 이상 최신 TensorFlow Lite 런타임 버전과 호환되지 않습니다. 또한 Google은 Coral 프로젝트를 완전히 포기한 것으로 보이며, 2021년과 2025년 사이에 업데이트가 전혀 없었습니다. 본 가이드에서는 Raspberry Pi 싱글 보드 컴퓨터(SBC)에서 최신 TensorFlow Lite 런타임 버전 및 업데이트된 Coral Edge TPU 런타임을 사용하여 Edge TPU를 작동시키는 방법을 설명합니다.

사전 요구 사항

설치 단계별 가이드

이 가이드는 사용자가 이미 Raspberry Pi OS를 정상적으로 설치하고 ultralytics 및 모든 의존성 패키지를 설치 완료했음을 가정합니다. ultralytics를 설치하려면 계속 진행하기 전에 빠른 시작 가이드를 방문하여 설정하십시오.

Edge TPU 런타임 설치하기

먼저 Edge TPU 런타임을 설치해야 합니다. 다양한 버전이 존재하므로 운영 체제에 맞는 올바른 버전을 선택해야 합니다. 고주파수 버전은 Edge TPU를 더 높은 클록 속도로 실행하여 성능을 향상시킵니다. 하지만 이로 인해 Edge TPU의 열 스로틀링(thermal throttling)이 발생할 수 있으므로, 적절한 냉각 장치를 갖추는 것이 권장됩니다.

Raspberry Pi OS고주파수 모드다운로드할 버전
Bullseye 32bit아니요libedgetpu1-std_ ... .bullseye_armhf.deb
Bullseye 64bit아니요libedgetpu1-std_ ... .bullseye_arm64.deb
Bullseye 32bitlibedgetpu1-max_ ... .bullseye_armhf.deb
Bullseye 64bitlibedgetpu1-max_ ... .bullseye_arm64.deb
Bookworm 32bit아니요libedgetpu1-std_ ... .bookworm_armhf.deb
Bookworm 64bit아니요libedgetpu1-std_ ... .bookworm_arm64.deb
Bookworm 32bitlibedgetpu1-max_ ... .bookworm_armhf.deb
Bookworm 64bitlibedgetpu1-max_ ... .bookworm_arm64.deb

여기에서 최신 버전 다운로드.

파일을 다운로드한 후 다음 명령어로 설치할 수 있습니다:

sudo dpkg -i path/to/package.deb

런타임 설치 후, Coral Edge TPU를 Raspberry Pi의 USB 3.0 포트에 연결하여 새로운 udev 규칙이 적용되도록 하십시오.

주의

Coral Edge TPU 런타임이 이미 설치되어 있다면 다음 명령어를 사용하여 제거하십시오.

# If you installed the standard version
sudo apt remove libedgetpu1-std

# If you installed the high-frequency version
sudo apt remove libedgetpu1-max

Edge TPU로 내보내기

Edge TPU를 사용하려면 모델을 호환 가능한 형식으로 변환해야 합니다. ARM에서는 Edge TPU 컴파일러를 사용할 수 없으므로, Google Colab, x86_64 Linux 머신, 공식 Ultralytics Docker 컨테이너 사용, 또는 Ultralytics Platform 사용을 권장합니다. 사용 가능한 인수는 내보내기 모드를 참조하십시오.

모델 내보내기
from ultralytics import YOLO

# Load a model
model = YOLO("path/to/model.pt")  # Load an official model or custom model

# Export the model
model.export(format="edgetpu")

내보낸 모델은 <model_name>_saved_model/ 폴더에 <model_name>_full_integer_quant_edgetpu.tflite라는 이름으로 저장됩니다. 파일 이름이 반드시 _edgetpu.tflite 접미사로 끝나는지 확인하십시오. 그렇지 않으면 Ultralytics가 Edge TPU 모델 사용을 감지하지 못합니다.

모델 실행

모델을 실제로 실행하려면 먼저 올바른 라이브러리를 설치해야 합니다.

TensorFlow가 이미 설치되어 있다면 다음 명령어로 제거하십시오:

pip uninstall tensorflow tensorflow-aarch64

그런 다음 tflite-runtime을 설치하거나 업데이트하십시오:

pip install -U tflite-runtime

이제 다음 코드를 사용하여 추론을 실행할 수 있습니다:

모델 실행
from ultralytics import YOLO

# Load a model
model = YOLO("path/to/<model_name>_full_integer_quant_edgetpu.tflite")  # Load an official model or custom model

# Run Prediction
model.predict("path/to/source.png")

전체 예측 모드에 대한 자세한 정보는 예측 페이지에서 확인하십시오.

여러 개의 Edge TPU를 사용한 추론

여러 개의 Edge TPU를 사용하는 경우 다음 코드를 사용하여 특정 TPU를 선택할 수 있습니다.

from ultralytics import YOLO

# Load a model
model = YOLO("path/to/<model_name>_full_integer_quant_edgetpu.tflite")  # Load an official model or custom model

# Run Prediction
model.predict("path/to/source.png")  # Inference defaults to the first TPU

model.predict("path/to/source.png", device="tpu:0")  # Select the first TPU

model.predict("path/to/source.png", device="tpu:1")  # Select the second TPU

벤치마크

벤치마크

Raspberry Pi OS Bookworm 64비트 및 USB Coral Edge TPU로 테스트되었습니다.

참고

표시된 시간은 추론 시간이며, 전처리/후처리는 포함되지 않았습니다.

이미지 크기모델표준 추론 시간 (ms)고주파수 추론 시간 (ms)
320YOLOv8n32.226.7
320YOLOv8s47.139.8
512YOLOv8n73.560.7
512YOLOv8s149.6125.3

평균적으로:

  • Raspberry Pi 5는 표준 모드에서 Raspberry Pi 4B보다 22% 더 빠릅니다.
  • Raspberry Pi 5는 고주파수 모드에서 Raspberry Pi 4B보다 30.2% 더 빠릅니다.
  • 고주파수 모드는 표준 모드보다 28.4% 더 빠릅니다.

FAQ

Coral Edge TPU란 무엇이며 Ultralytics YOLO26과 함께 Raspberry Pi의 성능을 어떻게 향상시킵니까?

Coral Edge TPU는 시스템에 Edge TPU 보조 프로세서를 추가하도록 설계된 소형 장치입니다. 이 보조 프로세서는 저전력, 고성능 머신 러닝 추론을 가능하게 하며, 특히 TensorFlow Lite 모델에 최적화되어 있습니다. Raspberry Pi 사용 시, Edge TPU는 ML 모델 추론을 가속화하여 특히 Ultralytics YOLO26 모델의 성능을 크게 높여줍니다. Coral Edge TPU에 대한 자세한 내용은 홈페이지에서 읽어보실 수 있습니다.

Raspberry Pi에 Coral Edge TPU 런타임을 어떻게 설치합니까?

To install the Coral Edge TPU runtime on your Raspberry Pi, download the appropriate .deb package for your Raspberry Pi OS version from this link. Once downloaded, use the following command to install it:

sudo dpkg -i path/to/package.deb

설치 단계별 가이드 섹션의 단계를 따라 이전 Coral Edge TPU 런타임 버전을 반드시 제거하십시오.

Ultralytics YOLO26 모델을 Coral Edge TPU와 호환되도록 내보낼 수 있습니까?

네, Ultralytics YOLO26 모델을 Coral Edge TPU와 호환되도록 내보낼 수 있습니다. Google Colab, x86_64 Linux 머신 또는 Ultralytics Docker 컨테이너를 사용하여 내보내는 것을 권장합니다. 내보내기를 위해 Ultralytics Platform을 사용할 수도 있습니다. 다음은 Python 및 CLI를 사용하여 모델을 내보내는 방법입니다:

모델 내보내기
from ultralytics import YOLO

# Load a model
model = YOLO("path/to/model.pt")  # Load an official model or custom model

# Export the model
model.export(format="edgetpu")

자세한 내용은 내보내기 모드 문서를 참조하십시오.

Raspberry Pi에 TensorFlow가 이미 설치되어 있는데 tflite-runtime을 사용하려면 어떻게 해야 합니까?

Raspberry Pi에 TensorFlow가 설치되어 있고 tflite-runtime으로 전환해야 하는 경우, 먼저 다음 명령어를 사용하여 TensorFlow를 제거해야 합니다:

pip uninstall tensorflow tensorflow-aarch64

그런 다음 다음 명령어로 tflite-runtime을 설치하거나 업데이트하십시오:

pip install -U tflite-runtime

자세한 지침은 모델 실행 섹션을 참조하십시오.

Coral Edge TPU를 사용하여 Raspberry Pi에서 내보낸 YOLO26 모델로 추론을 실행하려면 어떻게 합니까?

YOLO26 모델을 Edge TPU 호환 형식으로 내보낸 후, 다음 코드 조각을 사용하여 추론을 실행할 수 있습니다:

모델 실행
from ultralytics import YOLO

# Load a model
model = YOLO("path/to/edgetpu_model.tflite")  # Load an official model or custom model

# Run Prediction
model.predict("path/to/source.png")

전체 예측 모드 기능에 대한 자세한 내용은 예측 페이지에서 확인하실 수 있습니다.

댓글