Dockerfile 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. FROM ubuntu:18.04
  2. LABEL maintainer "blakeb@blakeshome.com"
  3. ENV DEBIAN_FRONTEND=noninteractive
  4. # Install packages for apt repo
  5. RUN apt -qq update && apt -qq install --no-install-recommends -y \
  6. software-properties-common \
  7. # apt-transport-https ca-certificates \
  8. build-essential \
  9. gnupg wget unzip \
  10. # libcap-dev \
  11. && add-apt-repository ppa:deadsnakes/ppa -y \
  12. && apt -qq install --no-install-recommends -y \
  13. python3.7 \
  14. python3.7-dev \
  15. python3-pip \
  16. ffmpeg \
  17. # VAAPI drivers for Intel hardware accel
  18. libva-drm2 libva2 i965-va-driver vainfo \
  19. && python3.7 -m pip install -U wheel setuptools \
  20. && python3.7 -m pip install -U \
  21. opencv-python-headless \
  22. # python-prctl \
  23. numpy \
  24. imutils \
  25. scipy \
  26. && python3.7 -m pip install -U \
  27. SharedArray \
  28. Flask \
  29. paho-mqtt \
  30. PyYAML \
  31. matplotlib \
  32. pyarrow \
  33. && echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list \
  34. && wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
  35. && apt -qq update \
  36. && echo "libedgetpu1-max libedgetpu/accepted-eula boolean true" | debconf-set-selections \
  37. && apt -qq install --no-install-recommends -y \
  38. libedgetpu1-max \
  39. ## Tensorflow lite (python 3.7 only)
  40. && wget -q https://dl.google.com/coral/python/tflite_runtime-2.1.0-cp37-cp37m-linux_x86_64.whl \
  41. && python3.7 -m pip install tflite_runtime-2.1.0-cp37-cp37m-linux_x86_64.whl \
  42. && rm tflite_runtime-2.1.0-cp37-cp37m-linux_x86_64.whl \
  43. && rm -rf /var/lib/apt/lists/* \
  44. && (apt-get autoremove -y; apt-get autoclean -y)
  45. # get model and labels
  46. RUN wget -q https://github.com/google-coral/edgetpu/raw/master/test_data/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite -O /edgetpu_model.tflite --trust-server-names
  47. RUN wget -q https://dl.google.com/coral/canned_models/coco_labels.txt -O /labelmap.txt --trust-server-names
  48. RUN wget -q https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip -O /cpu_model.zip && \
  49. unzip /cpu_model.zip detect.tflite -d / && \
  50. mv /detect.tflite /cpu_model.tflite && \
  51. rm /cpu_model.zip
  52. WORKDIR /opt/frigate/
  53. ADD frigate frigate/
  54. COPY detect_objects.py .
  55. COPY benchmark.py .
  56. CMD ["python3.7", "-u", "detect_objects.py"]