features added:

- GPU via TensorRT
 - CPU: TensorFlow Lite -> Tensorflow
This commit is contained in:
Alexander Smirnov
2020-04-08 20:53:58 +01:00
parent 2bc57d271c
commit 2298ca740c
16 changed files with 914 additions and 55 deletions
Executable → Regular
+17 -15
View File
@@ -9,22 +9,20 @@ RUN apt -qq update && apt -qq install --no-install-recommends -y \
build-essential \
gnupg wget unzip \
# libcap-dev \
&& add-apt-repository ppa:deadsnakes/ppa -y \
&& apt -qq install --no-install-recommends -y \
python3.7 \
python3.7-dev \
python3-dev \
python3-pip \
ffmpeg \
# VAAPI drivers for Intel hardware accel
libva-drm2 libva2 i965-va-driver vainfo \
&& python3.7 -m pip install -U wheel setuptools \
&& python3.7 -m pip install -U \
&& python3 -m pip install -U wheel pip setuptools \
&& python3 -m pip install -U \
opencv-python-headless \
# python-prctl \
numpy \
imutils \
scipy \
&& python3.7 -m pip install -U \
&& python3 -m pip install -U \
Flask \
paho-mqtt \
PyYAML \
@@ -37,23 +35,27 @@ RUN apt -qq update && apt -qq install --no-install-recommends -y \
&& apt -qq install --no-install-recommends -y \
libedgetpu1-max \
## Tensorflow lite (python 3.7 only)
&& wget -q https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
&& python3.7 -m pip install tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
&& rm tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
&& wget -q https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp36-cp36m-linux_x86_64.whl \
&& python3 -m pip install tflite_runtime-2.1.0.post1-cp36-cp36m-linux_x86_64.whl \
&& rm tflite_runtime-2.1.0.post1-cp36-cp36m-linux_x86_64.whl \
&& rm -rf /var/lib/apt/lists/* \
&& (apt-get autoremove -y; apt-get autoclean -y)
&& (apt-get autoremove -y; apt-get autoclean -y) \
## Tensorflow
&& python3 -m pip install tensorflow==1.15.2
# get model and labels
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
RUN wget -q https://dl.google.com/coral/canned_models/coco_labels.txt -O /labelmap.txt --trust-server-names
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 && \
unzip /cpu_model.zip detect.tflite -d / && \
mv /detect.tflite /cpu_model.tflite && \
rm /cpu_model.zip
RUN wget -q http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2018_01_28.tar.gz -O /cpu_model.tar.gz && \
tar -xf /cpu_model.tar.gz -C / ssd_mobilenet_v1_coco_2018_01_28/frozen_inference_graph.pb --strip-components 1 && \
mv /frozen_inference_graph.pb /cpu_model.pb && \
rm /cpu_model.tar.gz
WORKDIR /opt/frigate/
ADD frigate frigate/
COPY detect_objects.py .
COPY benchmark.py .
CMD ["python3.7", "-u", "detect_objects.py"]
ENV TF_CPP_MIN_LOG_LEVEL 2
CMD ["python3", "-u", "detect_objects.py"]