-
-
Notifications
You must be signed in to change notification settings - Fork 444
Expand file tree
/
Copy pathDockerfile
More file actions
56 lines (48 loc) · 3.17 KB
/
Dockerfile
File metadata and controls
56 lines (48 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# syntax=docker/dockerfile:1
# ─────────────────────────────────────────────────────────────────────────────
# Coral Edge TPU Model Compiler
#
# Compiles YOLO 2026 nano to Google Coral Edge TPU .tflite format using
# ultralytics' built-in format="edgetpu" export pipeline.
#
# Per https://docs.ultralytics.com/guides/coral-edge-tpu-on-raspberry-pi/:
# model.export(format="edgetpu") handles the full pipeline:
# .pt → ONNX → onnx2tf SavedModel → TFLite INT8 → edgetpu_compiler
#
# MUST run on linux/amd64 — edgetpu_compiler is x86_64 Linux only.
# On Apple Silicon or Windows, Docker Desktop handles QEMU emulation.
# ─────────────────────────────────────────────────────────────────────────────
FROM --platform=linux/amd64 python:3.11-slim
LABEL maintainer="Aegis-AI / DeepCamera"
LABEL description="Compiles YOLO 2026 to Google Coral Edge TPU .tflite"
# ── System deps ───────────────────────────────────────────────────────────────
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
gnupg \
apt-transport-https \
ca-certificates \
libgl1 \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# ── edgetpu_compiler from Google Coral apt (x86_64 only) ─────────────────────
RUN curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg \
| gpg --dearmor -o /usr/share/keyrings/coral-edgetpu.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/coral-edgetpu.gpg] \
https://packages.cloud.google.com/apt coral-edgetpu-stable main" \
> /etc/apt/sources.list.d/coral-edgetpu.list \
&& apt-get update \
&& apt-get install -y --no-install-recommends edgetpu-compiler \
&& rm -rf /var/lib/apt/lists/*
# ── Python: ultralytics handles all TF/onnx2tf version management ─────────────
# ultralytics auto-installs: onnx2tf, tensorflow-cpu, onnxslim, etc.
RUN pip install --no-cache-dir \
"ultralytics>=8.3.0" \
"numpy>=1.24.0,<2.0"
# ── Copy compile entrypoint ───────────────────────────────────────────────────
WORKDIR /compile
COPY scripts/compile_model.py /compile/compile_model.py
# ── Output volume (mount skill's models/ directory here) ──────────────────────
VOLUME ["/compile/output"]
# ── Entrypoint ────────────────────────────────────────────────────────────────
ENTRYPOINT ["python", "/compile/compile_model.py"]
CMD ["--model", "yolo26n", "--size", "320", "--output", "/compile/output"]