-
Notifications
You must be signed in to change notification settings - Fork 32
/
Dockerfile.pi4.base
64 lines (55 loc) · 2.36 KB
/
Dockerfile.pi4.base
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
57
58
59
60
61
62
63
64
FROM balenalib/raspberrypi4-64:bullseye AS base
ENV DEBIAN_FRONTEND=noninteractive
ENV TF_CPP_MIN_LOG_LEVEL=2
# Install basic packages
RUN install_packages \
ca-certificates \
wget \
unzip \
gnupg2 \
python3-pip \
&& python3 -m pip install --upgrade \
pip \
setuptools \
wheel
# Install dependencies
RUN python3 -m pip install \
numpy \
scipy \
opencv-python-headless \
PyYaml \
cerberus \
shapely \
werkzeug \
paho-mqtt \
https://github.com/google-coral/pycoral/releases/download/v2.0.0/tflite_runtime-2.5.0.post1-cp39-cp39-linux_aarch64.whl
# Install FFmpeg
RUN install_packages \
ffmpeg
# Install the Edge TPU runtime
RUN echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list \
&& wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
&& install_packages \
libedgetpu1-std \
python3-pycoral
# Enable udevd in the container to get rid of "Error in device opening" for the Coral USB Accelerator.
# The container also need to be run privileged, so we leave the default root user.
ENV UDEV=1
RUN echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="1a6e", GROUP="plugdev"' >> /etc/udev/rules.d/99-tpu.rules \
&& echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", GROUP="plugdev"' >> /etc/udev/rules.d/99-tpu.rule
# Dedicated user
RUN mkdir /etc/watsor /usr/share/watsor /var/log/watsor && \
addgroup -gid 1001 watsor && \
adduser -uid 1001 -gid 1001 -gecos watsor -home /usr/share/watsor --no-create-home --disabled-password watsor && \
usermod -a --groups video,plugdev watsor && \
chown -R watsor /etc/watsor /usr/share/watsor /var/log/watsor
# Download object detection models
RUN mkdir model && \
wget -q https://github.com/google-coral/test_data/raw/master/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite -O model/edgetpu.tflite --trust-server-names && \
wget -q https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip -O model/cpu.zip && \
unzip model/cpu.zip detect.tflite -d model && \
mv model/detect.tflite model/cpu.tflite && \
rm model/cpu.zip && \
mv model /usr/share/watsor/model && \
chown -R watsor:watsor /usr/share/watsor/model
EXPOSE 8080