exploratory

This commit is contained in:
YS 2021-12-17 19:34:13 +03:00
parent 9e4017da5d
commit eaafff5e06
4 changed files with 15 additions and 102 deletions

View File

@ -39,9 +39,7 @@ RUN pip3 wheel --wheel-dir=/wheels \
setproctitle \ setproctitle \
peewee peewee
FROM nvcr.io/nvidia/l4t-tensorflow:r32.6.1-tf2.5-py3
FROM nvcr.io/nvidia/l4t-tensorflow:r32.6.1-tf2.5-py3 as base
ENV DEBIAN_FRONTEND=noninteractive ENV DEBIAN_FRONTEND=noninteractive
RUN \ RUN \
apt-get update && apt-get install -y gnupg apt-get update && apt-get install -y gnupg
@ -80,7 +78,9 @@ RUN pip3 install \
peewee_migrate \ peewee_migrate \
pydantic \ pydantic \
zeroconf \ zeroconf \
ws4py ws4py \
# Python 3.6
shared-memory38
# setup gstreamer # setup gstreamer
@ -108,16 +108,13 @@ RUN wget -q https://github.com/google-coral/test_data/raw/release-frogfish/ssdli
COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/ COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/
COPY --from=web /opt/frigate/build /opt/frigate/web/
# s6-overlay # s6-overlay
COPY docker/rootfs/ / COPY docker/rootfs/ /
ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-aarch64-installer /tmp/ ADD https://github.com/just-containers/s6-overlay/releases/download/v2.2.0.3/s6-overlay-aarch64-installer /tmp/
RUN chmod +x /tmp/s6-overlay-aarch64-installer && /tmp/s6-overlay-aarch64-installer / RUN chmod +x /tmp/s6-overlay-aarch64-installer && /tmp/s6-overlay-aarch64-installer /
COPY --from=web /opt/frigate/build web/
# Backports
RUN pip3 install shared-memory38
WORKDIR /opt/frigate/ WORKDIR /opt/frigate/
ADD frigate frigate/ ADD frigate frigate/
@ -125,96 +122,12 @@ ADD migrations migrations/
COPY labelmap.txt /labelmap.txt COPY labelmap.txt /labelmap.txt
# edgetpu experiments
RUN wget -q https://github.com/Azure/Azure-AI-Camp/releases/download/v1.0/yolov4-tiny.tflite -O /yolov4-tiny.tflite
EXPOSE 5000 EXPOSE 5000
EXPOSE 1935 EXPOSE 1935
ENTRYPOINT ["/init"] ENTRYPOINT ["/init"]
CMD ["python3", "-u", "-m", "frigate"] CMD ["python3", "-u", "-m", "frigate"]
COPY frigate frigate/ COPY frigate frigate/
# # glibc-2.29
# RUN apt-get -qq update && \
# apt-get -qq install gawk bison
# RUN \
# mkdir -p /opt/glibc-2.29/etc && cd /opt/glibc-2.29/etc && sh -c "echo '/opt/lib' >> ld.so.conf" && \
# DIR=/tmp/glibc && \
# mkdir -p ${DIR} && \
# cd ${DIR} && \
# curl -L http://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.gz | tar xvz && \
# ./glibc-2.29/configure --prefix=/opt/glibc-2.29 && \
# make && \
# make install && \
# rm -rf ${DIR}
# RUN apt-get install -y openssl libssl-dev
# RUN \
# DIR=/tmp/cmake && \
# mkdir -p ${DIR} && \
# cd ${DIR} && \
# curl -L https://github.com/Kitware/CMake/releases/download/v3.22.0/cmake-3.22.0.tar.gz | tar xvz && cd cmake-3.22.0 && \
# ./bootstrap -- -DCMAKE_USE_OPENSSL=ON && \
# make && \
# make install && \
# rm -rf ${DIR}
# RUN \
# git clone https://github.com/tensorflow/tensorflow.git tensorflow_src
# RUN \
# apt-get install -y curl && \
# mkdir tflite_build && cd tflite_build && \
# cmake ../tensorflow_src/tensorflow/lite -DTFLITE_ENABLE_GPU=ON && \
# cmake --build . -j && pwd
# # RUN \
# # DIR=/${HOME}/tensorflow && \
# # mkdir -p ${DIR} && \
# # cd ${DIR} && \
# # curl -LO https://storage.googleapis.com/mirror.tensorflow.org/developer.arm.com/media/Files/downloads/gnu-a/8.3-2019.03/binrel/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz && \
# # mkdir -p ${DIR}/toolchains && \
# # tar xvf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C ${DIR}/toolchains
# # RUN \
# # DIR=/${HOME}/tensorflow && \
# # cd ${DIR} && \
# # ARMCC_PREFIX=${DIR}/toolchains/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu/bin/aarch64-linux-gnu- && \
# # ARMCC_FLAGS="-funsafe-math-optimizations" && \
# # cmake -DCMAKE_C_COMPILER=${ARMCC_PREFIX}gcc \
# # -DCMAKE_CXX_COMPILER=${ARMCC_PREFIX}g++ \
# # -DCMAKE_C_FLAGS="${ARMCC_FLAGS}" \
# # -DCMAKE_CXX_FLAGS="${ARMCC_FLAGS}" \
# # -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
# # -DCMAKE_SYSTEM_NAME=Linux \
# # -DCMAKE_SYSTEM_PROCESSOR=aarch64 \
# # ../tensorflow/lite/
# # RUN \
# # DIR=/tmp/tflite_runtime && \
# # mkdir -p ${DIR} && \
# # wget -q https://github.com/google-coral/pycoral/releases/download/v1.0.1/tflite_runtime-2.5.0-cp38-cp38-linux_aarch64.whl -O ${DIR}/tflite_runtime-2.5.0.post1-cp38-cp38-linux_aarch64.whl && \
# # pip3 install -U ${DIR}/*.whl && \
# # rm -rf ${DIR}
# # RUN \
# # DIR=/tmp/pycoral && \
# # mkdir -p ${DIR} && \
# # wget -q https://github.com/google-coral/pycoral/releases/download/v2.0.0/pycoral-2.0.0-cp38-cp38-linux_aarch64.whl -O ${DIR}/pycoral-2.0.0-cp38-cp38-linux_aarch64.whl && \
# # pip3 install -U ${DIR}/*.whl && \
# # rm -rf ${DIR}
# FROM scratch
# COPY --from=build /wheels /wheels

View File

@ -107,7 +107,7 @@ def create_mqtt_client(config: FrigateConfig, camera_metrics):
+ str(rc) + str(rc)
) )
logger.info("MQTT connected") logger.debug("MQTT connected")
client.subscribe(f"{mqtt_config.topic_prefix}/#") client.subscribe(f"{mqtt_config.topic_prefix}/#")
client.publish(mqtt_config.topic_prefix + "/available", "online", retain=True) client.publish(mqtt_config.topic_prefix + "/available", "online", retain=True)

View File

@ -32,11 +32,10 @@ class FFMpegConverter:
ffmpeg_cmd = f"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size {in_width}x{in_height} -i pipe: -f mpegts -s {out_width}x{out_height} -codec:v mpeg1video -q {quality} -bf 0 pipe:".split( ffmpeg_cmd = f"ffmpeg -f rawvideo -pix_fmt yuv420p -video_size {in_width}x{in_height} -i pipe: -f mpegts -s {out_width}x{out_height} -codec:v mpeg1video -q {quality} -bf 0 pipe:".split(
" " " "
) )
# ffmpeg_cmd = f"gst-launch-1.0 rtspsrc location=\"rtsp://admin:123456@192.168.5.95:554/stream0\" ! rtph265depay ! h265parse ! omxh265dec ! 'video/x-raw,format=(string)NV12' ! videoconvert ! 'video/x-raw, width={in_width}, height={in_height}, format=I420, framerate=(fraction)10/1' ! omxh264enc bitrate=500000 temporal-tradeoff=2 iframeinterval=10 ! h264parse ! mpegtsmux ! fdsink"
# ffmpeg_cmd = f"gst-launch-1.0 fdsrc ! video/x-raw, width={in_width}, height={in_height}, format=I420 ! nvvideoconvert ! omxh264enc ! h264parse ! mpegtsmux ! fdsink".split( # # .split(
# " " # # " "
# ) # # )
self.logpipe = LogPipe( self.logpipe = LogPipe(
"ffmpeg.converter", logging.ERROR) "ffmpeg.converter", logging.ERROR)
@ -46,6 +45,7 @@ class FFMpegConverter:
stderr=self.logpipe, stderr=self.logpipe,
stdin=sp.PIPE, stdin=sp.PIPE,
start_new_session=True, start_new_session=True,
# shell=True
) )
def write(self, b): def write(self, b):

View File

@ -286,7 +286,7 @@ class RecordingCleanup(threading.Thread):
["find", RECORD_DIR, "-type", "f", "!", "-newermt", f"@{oldest_timestamp}"], ["find", RECORD_DIR, "-type", "f", "!", "-newermt", f"@{oldest_timestamp}"],
stdout=sp.PIPE, stdout=sp.PIPE,
stderr=sp.PIPE, stderr=sp.PIPE,
text=True, universal_newlines=True,
) )
files_to_check = process.stdout.splitlines() files_to_check = process.stdout.splitlines()