Raspberry Pi에서 Coral Edge TPU와 함께 Ultralytics YOLO26 실행하기#
Raspberry Pi는 엣지에서 computer vision을 실행하기 위한 전력 효율이 높고 경제적인 플랫폼이지만, ONNX 또는 OpenVINO와 같은 최적화된 형식을 사용하더라도 디바이스에서의 inference는 느립니다. Pi를 Coral Edge TPU coprocessor와 함께 사용하면 inference를 전용 하드웨어로 오프로드하여 속도를 크게 향상할 수 있습니다. 이 가이드에서는 runtime을 설치하고, Ultralytics YOLO26 모델을 Edge TPU 형식으로 export하며, 가속된 inference를 실행하는 방법을 설명합니다.
Watch: How to Run Inference on Raspberry Pi using Google Coral Edge TPU
Coral Edge TPU를 사용하는 이유#
Coral Edge TPU는 시스템에 Edge TPU coprocessor를 추가하여 TensorFlow Lite 모델에 저전력·고성능 ML inference를 지원하는 소형 디바이스입니다. CPU만으로는 처리 성능을 따라가기 어려운 임베디드 및 모바일 배포 환경에 적합합니다:
- 더 빠른 inference — Edge TPU는 Raspberry Pi CPU 단독으로 달성할 수 있는 수준을 훨씬 뛰어넘는 속도로 quantized 모델을 가속합니다.
- 낮은 전력 소비 — 와트당 높은 처리량을 제공하므로 배터리 또는 태양광으로 구동되는 배포 환경에 적합합니다.
- 플러그 앤 플레이 — USB Accelerator는 USB 3.0을 통해 연결되므로 추가 하드웨어 통합이 필요하지 않습니다.
공식 Coral 가이드는 오래되었습니다. 기존 Coral runtime 빌드는 현재 TensorFlow Lite runtime 버전에서 더 이상 작동하지 않으며, 프로젝트는 2021년부터 2025년까지 업데이트가 없었습니다. 이 가이드에서는 현재 Raspberry Pi OS 설치 환경에서 accelerator가 작동하도록 적극적으로 유지 관리되는 Edge TPU runtime과 최신 tflite-runtime을 사용합니다.
필수 조건#
- Raspberry Pi 4B(2GB 이상 권장) 또는 Raspberry Pi 5(권장)
- 데스크톱이 포함된 Raspberry Pi OS Bullseye/Bookworm(64-bit)(권장)
- Coral USB Accelerator
- Edge TPU compiler를 ARM에서 사용할 수 없으므로 모델을 export하기 위한 비 ARM 플랫폼(Google Colab, x86_64 Linux 시스템 또는 Ultralytics Docker container)
이 가이드에서는 ultralytics 및 해당 dependencies가 설치된 작동하는 Raspberry Pi OS 환경을 이미 갖추고 있다고 가정합니다. 그렇지 않다면 먼저 빠른 시작 가이드를 따르세요.
사전 요구 사항을 갖추면 workflow는 세 단계로 진행됩니다. Pi에 Edge TPU runtime 설치, 비 ARM 시스템에서 모델 export, Pi에서 다시 inference 실행입니다.
Edge TPU Runtime 설치#
runtime은 여러 빌드로 제공되므로 운영 체제에 맞는 빌드를 선택하세요. high-frequency 빌드는 Edge TPU를 더 높은 clock speed로 실행하여 성능을 향상하지만 thermal throttling이 발생할 수 있으므로, 이를 선택하는 경우 어떤 형태로든 cooling을 사용하세요.
| Raspberry Pi OS | High frequency 모드 | 다운로드할 버전 |
|---|---|---|
| Bullseye 32bit | 아니요 | libedgetpu1-std_ ... .bullseye_armhf.deb |
| Bullseye 64bit | 아니요 | libedgetpu1-std_ ... .bullseye_arm64.deb |
| Bullseye 32bit | 예 | libedgetpu1-max_ ... .bullseye_armhf.deb |
| Bullseye 64bit | 예 | libedgetpu1-max_ ... .bullseye_arm64.deb |
| Bookworm 32bit | 아니요 | libedgetpu1-std_ ... .bookworm_armhf.deb |
| Bookworm 64bit | 아니요 | libedgetpu1-std_ ... .bookworm_arm64.deb |
| Bookworm 32bit | 예 | libedgetpu1-max_ ... .bookworm_armhf.deb |
| Bookworm 64bit | 예 | libedgetpu1-max_ ... .bookworm_arm64.deb |
여기에서 최신 버전을 다운로드한 다음 .deb package를 설치합니다:
sudo dpkg -i path/to/package.debruntime을 설치한 후 Raspberry Pi의 USB 3.0 port에 Coral Edge TPU를 연결하면 새 udev rule이 적용됩니다.
먼저 기존 runtime 제거
Coral Edge TPU runtime이 이미 설치되어 있다면 새 빌드를 설치하기 전에 제거하세요.
# 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 형식으로 Export하기#
Edge TPU를 사용하려면 모델을 호환 형식으로 변환해야 합니다. Edge TPU compiler를 ARM에서 사용할 수 없으므로 Google Colab, x86_64 Linux 시스템, 공식 Ultralytics Docker container 또는 Ultralytics Platform과 같은 비 ARM 플랫폼에서 export를 실행하세요. 사용 가능한 arguments는 Export mode를 참조하세요.
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")export된 모델은 <model_name>_saved_model/ folder에 <model_name>_full_integer_quant_edgetpu.tflite로 저장됩니다.
파일 이름은 _edgetpu.tflite으로 끝나야 합니다. 다른 이름으로 변경하면 Ultralytics는 이를 Edge TPU를 감지하지 못하고 일반 TensorFlow Lite 모델로 로드하므로 accelerator가 사용되지 않습니다.
Edge TPU에서 Inference 실행하기#
모델을 실행하기 전에 Raspberry Pi에 올바른 libraries를 설치하세요. TensorFlow가 이미 설치되어 있다면 먼저 제거합니다:
pip uninstall tensorflow tensorflow-aarch64그런 다음 tflite-runtime을 설치하거나 업데이트합니다:
pip install -U tflite-runtime이제 inference를 실행할 수 있습니다:
from ultralytics import YOLO
# Load a model
model = YOLO("path/to/yolo26n_full_integer_quant_edgetpu.tflite") # Load an official model or custom model
# Run Prediction
model.predict("path/to/source.png")전체 prediction mode 세부 정보는 Predict 페이지에서 확인하세요.
여러 Edge TPU가 있는 경우 device argument를 사용하여 특정 TPU를 선택할 수 있습니다.
from ultralytics import YOLO
# Load a model
model = YOLO("path/to/yolo26n_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-bit 및 USB Coral Edge TPU를 사용하여 측정했습니다. inference time만 보여 주며(pre-/postprocessing 제외), Pi 모델과 모드에 따라 Edge TPU가 제공하는 가속을 상대적으로 비교하기 위한 참고 자료입니다.
이 benchmark는 YOLOv8 모델로 측정했습니다. 절대적인 inference time은 모델 버전과 image size에 따라 달라지지만, Pi 모델과 clock mode 간의 상대적인 speedup은 유지됩니다.
| Image Size | 모델 | Standard Inference Time (ms) | High-Frequency Inference Time (ms) |
|---|---|---|---|
| 320 | YOLOv8n | 32.2 | 26.7 |
| 320 | YOLOv8s | 47.1 | 39.8 |
| 512 | YOLOv8n | 73.5 | 60.7 |
| 512 | YOLOv8s | 149.6 | 125.3 |
평균적으로:
- Raspberry Pi 5는 standard mode에서 Raspberry Pi 4B보다 22% 빠릅니다.
- Raspberry Pi 5는 high-frequency mode에서 Raspberry Pi 4B보다 30.2% 빠릅니다.
- high-frequency mode는 standard mode보다 28.4% 빠릅니다.
결론#
Coral Edge TPU는 Raspberry Pi를 Ultralytics YOLO26을 위한 성능이 뛰어난 저전력 inference 디바이스로 전환합니다. 비 ARM 시스템에서 모델을 export하고 _edgetpu.tflite suffix를 유지한 다음, Pi에서 tflite-runtime과 함께 실행하여 가속된 엣지 inference를 수행하세요. 더 많은 배포 옵션은 Raspberry Pi 가이드를 참조하세요.
FAQ#
Coral Edge TPU는 시스템에 Edge TPU coprocessor를 추가하는 소형 디바이스입니다. 이 coprocessor는 특히 TensorFlow Lite 모델에 최적화된 저전력·고성능 ML inference를 지원합니다. Raspberry Pi에서 CPU 단독으로 달성할 수 있는 수준을 훨씬 뛰어넘어 inference를 가속하므로 Ultralytics YOLO26 모델의 성능이 크게 향상됩니다.
이 링크에서 Raspberry Pi OS 버전에 맞는
.debpackage를 다운로드한 다음 설치합니다:sudo dpkg -i path/to/package.debEdge TPU Runtime 설치 섹션의 단계에 따라 이전 Coral Edge TPU runtime 버전을 모두 제거하세요.
예. Google Colab, x86_64 Linux 시스템 또는 Ultralytics Docker container에서 export를 실행하세요. Ultralytics Platform을 사용할 수도 있습니다. 다음은 Python과 CLI를 사용하여 export하는 방법입니다:
모델 Export하기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")자세한 내용은 Export mode documentation을 참조하세요.
TensorFlow가 설치되어 있고
tflite-runtime으로 전환해야 한다면 먼저 TensorFlow를 제거합니다:pip uninstall tensorflow tensorflow-aarch64그런 다음
tflite-runtime을 설치하거나 업데이트합니다:pip install -U tflite-runtime자세한 지침은 Edge TPU에서 Inference 실행하기 섹션을 참조하세요.
YOLO26 모델을 Edge TPU 호환 형식으로 export한 후 다음 snippets를 사용하여 inference를 실행합니다. Ultralytics가 모델을 Edge TPU에서 로드하도록 모델 파일의
_edgetpu.tflitesuffix를 유지해야 합니다:모델 실행하기from ultralytics import YOLO # Load a model model = YOLO("path/to/yolo26n_full_integer_quant_edgetpu.tflite") # Load an official model or custom model # Run Prediction model.predict("path/to/source.png")prediction mode에 대한 자세한 내용은 Predict 페이지에서 확인할 수 있습니다.