Basic attempt, no CI/CD cleanup yet

This commit is contained in:
Daniel Nowak 2024-05-08 12:20:27 -04:00
parent b451d0a4f1
commit 65626349d8
7 changed files with 35 additions and 9 deletions

View File

@ -16,6 +16,14 @@ apt-get -qq install --no-install-recommends -y \
jq \
nethogs
# Use latest distro-provided numpy-related libraries, rather than building wheels from scatch
apt-get -qq install --no-install-recommends --no-install-suggests -y \
python3-numpy python3-matplotlib python3-opencv python3-scipy -y
# Again, avoid complicated wheel build for lxml and onif_zeep by using distro-provided libraries
apt-get -qq install --no-install-recommends --no-install-suggests -y \
python3-lxml -y
# ensure python3 defaults to python3.9
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
@ -78,7 +86,14 @@ apt-get autoremove --purge -y
rm -rf /var/lib/apt/lists/*
# Install yq, for frigate-prepare and go2rtc echo source
if [[ "${TARGETARCH}" == "arm" ]]; then
curl -fsSL \
"https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_arm" \
--output /usr/local/bin/yq
chmod +x /usr/local/bin/yq
else
curl -fsSL \
"https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_$(dpkg --print-architecture)" \
--output /usr/local/bin/yq
chmod +x /usr/local/bin/yq
fi

View File

@ -6,6 +6,8 @@ s6_version="3.1.5.0"
if [[ "${TARGETARCH}" == "amd64" ]]; then
s6_arch="x86_64"
elif [[ "${TARGETARCH}" == "arm" ]]; then
s6_arch="armhf"
elif [[ "${TARGETARCH}" == "arm64" ]]; then
s6_arch="aarch64"
fi

View File

@ -2,11 +2,11 @@ click == 8.1.*
Flask == 3.0.*
imutils == 0.5.*
markupsafe == 2.1.*
matplotlib == 3.8.*
# matplotlib == 3.8.*
mypy == 1.6.1
numpy == 1.26.*
# numpy == 1.26.*
onvif_zeep == 0.2.12
opencv-python-headless == 4.9.0.*
# opencv-python-headless == 4.9.0.*
paho-mqtt == 2.0.*
pandas == 2.2.*
peewee == 3.17.*
@ -22,8 +22,8 @@ tzlocal == 5.2
types-PyYAML == 6.0.*
requests == 2.31.*
types-requests == 2.31.*
scipy == 1.13.*
norfair == 2.2.*
# scipy == 1.13.*
# norfair == 2.2.*
setproctitle == 1.3.*
ws4py == 0.5.*
unidecode == 1.3.*

View File

@ -1,2 +1,6 @@
--only-binary :all:
scikit-build == 0.17.*
nvidia-pyindex
norfair == 2.1.1
zeep == 3.0.0
onvif_zeep

View File

@ -6,7 +6,7 @@ ARG DEBIAN_FRONTEND=noninteractive
FROM deps AS rpi-deps
ARG TARGETARCH
RUN rm -rf /usr/lib/btbn-ffmpeg/
RUN if [[ "${TARGETARCH}" == "arm64" ]]; then rm -rf /usr/lib/btbn-ffmpeg/; fi
# Install dependencies
RUN --mount=type=bind,source=docker/rpi/install_deps.sh,target=/deps/install_deps.sh \

View File

@ -27,4 +27,11 @@ if [[ "${TARGETARCH}" == "arm64" ]]; then
echo "deb [signed-by=/usr/share/keyrings/raspbian.gpg] https://archive.raspberrypi.org/debian/ bullseye main" | tee /etc/apt/sources.list.d/raspi.list
apt-get -qq update
apt-get -qq install --no-install-recommends --no-install-suggests -y ffmpeg
# ffmpeg -> arm32
elif [[ "${TARGETARCH}" == "arm" ]]; then
# add raspberry pi repo
gpg --no-default-keyring --keyring /usr/share/keyrings/raspbian.gpg --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E
echo "deb [signed-by=/usr/share/keyrings/raspbian.gpg] http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi" | tee /etc/apt/sources.list.d/raspi.list
apt-get -qq update
apt-get -qq install --no-install-recommends --no-install-suggests -y ffmpeg
fi

View File

@ -19,7 +19,6 @@ class ImprovedMotionDetector(MotionDetector):
config: MotionConfig,
fps: int,
name="improved",
blur_radius=1,
interpolation=cv2.INTER_NEAREST,
contrast_frame_history=50,
):
@ -42,7 +41,6 @@ class ImprovedMotionDetector(MotionDetector):
self.mask = np.where(resized_mask == [0])
self.save_images = False
self.calibrating = True
self.blur_radius = blur_radius
self.interpolation = interpolation
self.contrast_values = np.zeros((contrast_frame_history, 2), np.uint8)
self.contrast_values[:, 1:2] = 255
@ -104,7 +102,7 @@ class ImprovedMotionDetector(MotionDetector):
# Setting masked pixels to zero, to match the average frame at startup
resized_frame[self.mask] = [0]
resized_frame = gaussian_filter(resized_frame, sigma=1, radius=self.blur_radius)
resized_frame = gaussian_filter(resized_frame, sigma=1)
if self.save_images:
blurred_saved = resized_frame.copy()