Skip to content

Commit 1db3aa1

Browse files
authored
Merge branch 'blakeblackshear:dev' into dev
2 parents 9f4f542 + 959ca0f commit 1db3aa1

25 files changed

+155
-106
lines changed

.devcontainer/post_create.sh

+6-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
set -euxo pipefail
44

55
# Cleanup the old github host key
6-
sed -i -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31\/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==/d' ~/.ssh/known_hosts
7-
# Add new github host key
8-
curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | \
9-
sed -e 's/^/github.com /' >> ~/.ssh/known_hosts
6+
if [[ -f ~/.ssh/known_hosts ]]; then
7+
# Add new github host key
8+
sed -i -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31\/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==/d' ~/.ssh/known_hosts
9+
curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | \
10+
sed -e 's/^/github.com /' >> ~/.ssh/known_hosts
11+
fi
1012

1113
# Frigate normal container runs as root, so it have permission to create
1214
# the folders. But the devcontainer runs as the host user, so we need to

docker/hailo8l/Dockerfile

+5-53
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
ARG DEBIAN_FRONTEND=noninteractive
44

5-
# NOTE: also update user_installation.sh
6-
ARG HAILO_VERSION=4.19.0
7-
85
# Build Python wheels
96
FROM wheels AS h8l-wheels
107

@@ -19,63 +16,18 @@ RUN mkdir /h8l-wheels
1916
# Build the wheels
2017
RUN pip3 wheel --wheel-dir=/h8l-wheels -c /requirements-wheels.txt -r /requirements-wheels-h8l.txt
2118

22-
# Build HailoRT and create wheel
23-
FROM wheels AS build-hailort
19+
FROM wget AS hailort
2420
ARG TARGETARCH
25-
ARG HAILO_VERSION
26-
27-
SHELL ["/bin/bash", "-c"]
28-
29-
# Install necessary APT packages
30-
RUN apt-get -qq update \
31-
&& apt-get -qq install -y \
32-
apt-transport-https \
33-
gnupg \
34-
wget \
35-
# the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html
36-
&& wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA4285295FC7B1A81600062A9605C66F00D6C9793" | \
37-
gpg --dearmor > /usr/share/keyrings/debian-archive-bullseye-stable.gpg \
38-
&& echo "deb [signed-by=/usr/share/keyrings/debian-archive-bullseye-stable.gpg] http://deb.debian.org/debian bullseye main contrib non-free" | \
39-
tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \
40-
&& apt-get -qq update \
41-
&& apt-get -qq install -y \
42-
python3.9 \
43-
python3.9-dev \
44-
build-essential cmake git \
45-
&& rm -rf /var/lib/apt/lists/*
46-
47-
# Extract Python version and set environment variables
48-
RUN PYTHON_VERSION=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2) && \
49-
PYTHON_VERSION_NO_DOT=$(echo $PYTHON_VERSION | sed 's/\.//') && \
50-
echo "PYTHON_VERSION=$PYTHON_VERSION" > /etc/environment && \
51-
echo "PYTHON_VERSION_NO_DOT=$PYTHON_VERSION_NO_DOT" >> /etc/environment
52-
53-
# Clone and build HailoRT
54-
RUN . /etc/environment && \
55-
git clone https://github.com/hailo-ai/hailort.git /opt/hailort && \
56-
cd /opt/hailort && \
57-
git checkout v${HAILO_VERSION} && \
58-
cmake -H. -Bbuild -DCMAKE_BUILD_TYPE=Release && \
59-
cmake --build build --config release --target libhailort && \
60-
cmake --build build --config release --target hailortcli && \
61-
cmake --build build --config release --target install
62-
63-
# Create a wheel file using pip3 wheel
64-
RUN cd /opt/hailort/hailort/libhailort/bindings/python/platform && \
65-
python3 setup.py bdist_wheel --dist-dir /hailo-wheels
66-
67-
RUN mkdir -p /rootfs/usr/local/lib /rootfs/usr/local/bin && \
68-
cp /usr/local/lib/libhailort.so* /rootfs/usr/local/lib && \
69-
cp /usr/local/bin/hailortcli /rootfs/usr/local/bin
21+
RUN --mount=type=bind,source=docker/hailo8l/install_hailort.sh,target=/deps/install_hailort.sh \
22+
/deps/install_hailort.sh
7023

7124
# Use deps as the base image
7225
FROM deps AS h8l-frigate
73-
ARG HAILO_VERSION
7426

7527
# Copy the wheels from the wheels stage
7628
COPY --from=h8l-wheels /h8l-wheels /deps/h8l-wheels
77-
COPY --from=build-hailort /hailo-wheels /deps/hailo-wheels
78-
COPY --from=build-hailort /rootfs/ /
29+
COPY --from=hailort /hailo-wheels /deps/hailo-wheels
30+
COPY --from=hailort /rootfs/ /
7931

8032
# Install the wheels
8133
RUN pip3 install -U /deps/h8l-wheels/*.whl

docker/hailo8l/h8l.hcl

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
target wget {
2+
dockerfile = "docker/main/Dockerfile"
3+
platforms = ["linux/arm64","linux/amd64"]
4+
target = "wget"
5+
}
6+
17
target wheels {
28
dockerfile = "docker/main/Dockerfile"
39
platforms = ["linux/arm64","linux/amd64"]
@@ -19,6 +25,7 @@ target rootfs {
1925
target h8l {
2026
dockerfile = "docker/hailo8l/Dockerfile"
2127
contexts = {
28+
wget = "target:wget"
2229
wheels = "target:wheels"
2330
deps = "target:deps"
2431
rootfs = "target:rootfs"

docker/hailo8l/install_hailort.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
set -euxo pipefail
4+
5+
hailo_version="4.19.0"
6+
7+
if [[ "${TARGETARCH}" == "amd64" ]]; then
8+
arch="x86_64"
9+
elif [[ "${TARGETARCH}" == "arm64" ]]; then
10+
arch="aarch64"
11+
fi
12+
13+
mkdir -p /rootfs
14+
15+
wget -qO- "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${TARGETARCH}.tar.gz" |
16+
tar -C /rootfs/ -xzf -
17+
18+
mkdir -p /hailo-wheels
19+
20+
wget -P /hailo-wheels/ "https://github.com/frigate-nvr/hailort/releases/download/v${hailo_version}/hailort-${hailo_version}-cp39-cp39-linux_${arch}.whl"
21+

docker/main/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,9 @@ ENV TOKENIZERS_PARALLELISM=true
211211
# https://github.com/huggingface/transformers/issues/27214
212212
ENV TRANSFORMERS_NO_ADVISORY_WARNINGS=1
213213

214+
# Set OpenCV ffmpeg loglevel to fatal: https://ffmpeg.org/doxygen/trunk/log_8h.html
215+
ENV OPENCV_FFMPEG_LOGLEVEL=8
216+
214217
ENV PATH="/usr/local/go2rtc/bin:/usr/local/tempio/bin:/usr/local/nginx/sbin:${PATH}"
215218
ENV LIBAVFORMAT_VERSION_MAJOR=60
216219

docs/docs/configuration/camera_specific.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ go2rtc:
181181
- rtspx://192.168.1.1:7441/abcdefghijk
182182
```
183183

184-
[See the go2rtc docs for more information](https://github.com/AlexxIT/go2rtc/tree/v1.9.4#source-rtsp)
184+
[See the go2rtc docs for more information](https://github.com/AlexxIT/go2rtc/tree/v1.9.2#source-rtsp)
185185

186186
In the Unifi 2.0 update Unifi Protect Cameras had a change in audio sample rate which causes issues for ffmpeg. The input rate needs to be set for record if used directly with unifi protect.
187187

docs/docs/configuration/objects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ title: Available Objects
55

66
import labels from "../../../labelmap.txt";
77

8-
Frigate includes the object models listed below from the Google Coral test data.
8+
Frigate includes the object labels listed below from the Google Coral test data.
99

1010
Please note:
1111

docs/docs/configuration/reference.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -556,10 +556,12 @@ genai:
556556
# Uses https://github.com/AlexxIT/go2rtc (v1.9.2)
557557
go2rtc:
558558

559-
# Optional: jsmpeg stream configuration for WebUI
559+
# Optional: Live stream configuration for WebUI.
560+
# NOTE: Can be overridden at the camera level
560561
live:
561-
# Optional: Set the name of the stream that should be used for live view
562-
# in frigate WebUI. (default: name of camera)
562+
# Optional: Set the name of the stream configured in go2rtc
563+
# that should be used for live view in frigate WebUI. (default: name of camera)
564+
# NOTE: In most cases this should be set at the camera level only.
563565
stream_name: camera_name
564566
# Optional: Set the height of the jsmpeg stream. (default: 720)
565567
# This must be less than or equal to the height of the detect stream. Lower resolutions

docs/docs/configuration/restream.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ title: Restream
77

88
Frigate can restream your video feed as an RTSP feed for other applications such as Home Assistant to utilize it at `rtsp://<frigate_host>:8554/<camera_name>`. Port 8554 must be open. [This allows you to use a video feed for detection in Frigate and Home Assistant live view at the same time without having to make two separate connections to the camera](#reduce-connections-to-camera). The video feed is copied from the original video feed directly to avoid re-encoding. This feed does not include any annotation by Frigate.
99

10-
Frigate uses [go2rtc](https://github.com/AlexxIT/go2rtc/tree/v1.9.4) to provide its restream and MSE/WebRTC capabilities. The go2rtc config is hosted at the `go2rtc` in the config, see [go2rtc docs](https://github.com/AlexxIT/go2rtc/tree/v1.9.4#configuration) for more advanced configurations and features.
10+
Frigate uses [go2rtc](https://github.com/AlexxIT/go2rtc/tree/v1.9.2) to provide its restream and MSE/WebRTC capabilities. The go2rtc config is hosted at the `go2rtc` in the config, see [go2rtc docs](https://github.com/AlexxIT/go2rtc/tree/v1.9.2#configuration) for more advanced configurations and features.
1111

1212
:::note
1313

@@ -134,7 +134,7 @@ cameras:
134134

135135
## Advanced Restream Configurations
136136

137-
The [exec](https://github.com/AlexxIT/go2rtc/tree/v1.9.4#source-exec) source in go2rtc can be used for custom ffmpeg commands. An example is below:
137+
The [exec](https://github.com/AlexxIT/go2rtc/tree/v1.9.2#source-exec) source in go2rtc can be used for custom ffmpeg commands. An example is below:
138138

139139
NOTE: The output will need to be passed with two curly braces `{{output}}`
140140

docs/docs/guides/configuring_go2rtc.md

+11-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,15 @@ Use of the bundled go2rtc is optional. You can still configure FFmpeg to connect
1313

1414
# Setup a go2rtc stream
1515

16-
First, you will want to configure go2rtc to connect to your camera stream by adding the stream you want to use for live view in your Frigate config file. For the best experience, you should set the stream name under go2rtc to match the name of your camera so that Frigate will automatically map it and be able to use better live view options for the camera. Avoid changing any other parts of your config at this step. Note that go2rtc supports [many different stream types](https://github.com/AlexxIT/go2rtc/tree/v1.9.4#module-streams), not just rtsp.
16+
First, you will want to configure go2rtc to connect to your camera stream by adding the stream you want to use for live view in your Frigate config file. Avoid changing any other parts of your config at this step. Note that go2rtc supports [many different stream types](https://github.com/AlexxIT/go2rtc/tree/v1.9.2#module-streams), not just rtsp.
17+
18+
:::tip
19+
20+
For the best experience, you should set the stream name under `go2rtc` to match the name of your camera so that Frigate will automatically map it and be able to use better live view options for the camera.
21+
22+
See [the live view docs](../configuration/live.md#setting-stream-for-live-ui) for more information.
23+
24+
:::
1725

1826
```yaml
1927
go2rtc:
@@ -39,8 +47,8 @@ After adding this to the config, restart Frigate and try to watch the live strea
3947

4048
- Check Video Codec:
4149
- If the camera stream works in go2rtc but not in your browser, the video codec might be unsupported.
42-
- If using H265, switch to H264. Refer to [video codec compatibility](https://github.com/AlexxIT/go2rtc/tree/v1.9.4#codecs-madness) in go2rtc documentation.
43-
- If unable to switch from H265 to H264, or if the stream format is different (e.g., MJPEG), re-encode the video using [FFmpeg parameters](https://github.com/AlexxIT/go2rtc/tree/v1.9.4#source-ffmpeg). It supports rotating and resizing video feeds and hardware acceleration. Keep in mind that transcoding video from one format to another is a resource intensive task and you may be better off using the built-in jsmpeg view.
50+
- If using H265, switch to H264. Refer to [video codec compatibility](https://github.com/AlexxIT/go2rtc/tree/v1.9.2#codecs-madness) in go2rtc documentation.
51+
- If unable to switch from H265 to H264, or if the stream format is different (e.g., MJPEG), re-encode the video using [FFmpeg parameters](https://github.com/AlexxIT/go2rtc/tree/v1.9.2#source-ffmpeg). It supports rotating and resizing video feeds and hardware acceleration. Keep in mind that transcoding video from one format to another is a resource intensive task and you may be better off using the built-in jsmpeg view.
4452
```yaml
4553
go2rtc:
4654
streams:

docs/docs/guides/getting_started.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,9 @@ By default, Frigate will retain video of all tracked objects for 10 days. The fu
306306
307307
### Step 7: Complete config
308308
309-
At this point you have a complete config with basic functionality. You can see the [full config reference](../configuration/reference.md) for a complete list of configuration options.
309+
At this point you have a complete config with basic functionality.
310+
- View [common configuration examples](../configuration/index.md#common-configuration-examples) for a list of common configuration examples.
311+
- View [full config reference](../configuration/reference.md) for a complete list of configuration options.
310312
311313
### Follow up
312314

docs/docs/plus/first_model.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ title: Requesting your first model
55

66
## Step 1: Upload and annotate your images
77

8-
Before requesting your first model, you will need to upload at least 10 images to Frigate+. But for the best results, you should provide at least 100 verified images per camera. Keep in mind that varying conditions should be included. You will want images from cloudy days, sunny days, dawn, dusk, and night. Refer to the [integration docs](../integrations/plus.md#generate-an-api-key) for instructions on how to easily submit images to Frigate+ directly from Frigate.
8+
Before requesting your first model, you will need to upload and verify at least 1 image to Frigate+. The more images you upload, annotate, and verify the better your results will be. Most users start to see very good results once they have at least 100 verified images per camera. Keep in mind that varying conditions should be included. You will want images from cloudy days, sunny days, dawn, dusk, and night. Refer to the [integration docs](../integrations/plus.md#generate-an-api-key) for instructions on how to easily submit images to Frigate+ directly from Frigate.
99

1010
It is recommended to submit **both** true positives and false positives. This will help the model differentiate between what is and isn't correct. You should aim for a target of 80% true positive submissions and 20% false positives across all of your images. If you are experiencing false positives in a specific area, submitting true positives for any object type near that area in similar lighting conditions will help teach the model what that area looks like when no objects are present.
1111

1212
For more detailed recommendations, you can refer to the docs on [improving your model](./improving_model.md).
1313

1414
## Step 2: Submit a model request
1515

16-
Once you have an initial set of verified images, you can request a model on the Models page. Each model request requires 1 of the 12 trainings that you receive with your annual subscription. This model will support all [label types available](./index.md#available-label-types) even if you do not submit any examples for those labels. Model creation can take up to 36 hours.
16+
Once you have an initial set of verified images, you can request a model on the Models page. For guidance on choosing a model type, refer to [this part of the documentation](./index.md#available-model-types). Each model request requires 1 of the 12 trainings that you receive with your annual subscription. This model will support all [label types available](./index.md#available-label-types) even if you do not submit any examples for those labels. Model creation can take up to 36 hours.
1717
![Plus Models Page](/img/plus/plus-models.jpg)
1818

1919
## Step 3: Set your model id in the config

docs/docs/plus/improving_model.md

+15-16
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ id: improving_model
33
title: Improving your model
44
---
55

6-
You may find that Frigate+ models result in more false positives initially, but by submitting true and false positives, the model will improve. Because a limited number of users submitted images to Frigate+ prior to this launch, you may need to submit several hundred images per camera to see good results. With all the new images now being submitted, future base models will improve as more and more users (including you) submit examples to Frigate+. Note that only verified images will be used when training your model. Submitting an image from Frigate as a true or false positive will not verify the image. You still must verify the image in Frigate+ in order for it to be used in training.
6+
You may find that Frigate+ models result in more false positives initially, but by submitting true and false positives, the model will improve. With all the new images now being submitted by subscribers, future base models will improve as more and more examples are incorporated. Note that only images with at least one verified label will be used when training your model. Submitting an image from Frigate as a true or false positive will not verify the image. You still must verify the image in Frigate+ in order for it to be used in training.
77

88
- **Submit both true positives and false positives**. This will help the model differentiate between what is and isn't correct. You should aim for a target of 80% true positive submissions and 20% false positives across all of your images. If you are experiencing false positives in a specific area, submitting true positives for any object type near that area in similar lighting conditions will help teach the model what that area looks like when no objects are present.
99
- **Lower your thresholds a little in order to generate more false/true positives near the threshold value**. For example, if you have some false positives that are scoring at 68% and some true positives scoring at 72%, you can try lowering your threshold to 65% and submitting both true and false positives within that range. This will help the model learn and widen the gap between true and false positive scores.
@@ -36,18 +36,17 @@ Misidentified objects should have a correct label added. For example, if a perso
3636

3737
## Shortcuts for a faster workflow
3838

39-
|Shortcut Key|Description|
40-
|-----|--------|
41-
|`?`|Show all keyboard shortcuts|
42-
|`w`|Add box|
43-
|`d`|Toggle difficult|
44-
|`s`|Switch to the next label|
45-
|`tab`|Select next largest box|
46-
|`del`|Delete current box|
47-
|`esc`|Deselect/Cancel|
48-
|`← ↑ → ↓`|Move box|
49-
|`Shift + ← ↑ → ↓`|Resize box|
50-
|`-`|Zoom out|
51-
|`=`|Zoom in|
52-
|`f`|Hide/show all but current box|
53-
|`spacebar`|Verify and save|
39+
| Shortcut Key | Description |
40+
| ----------------- | ----------------------------- |
41+
| `?` | Show all keyboard shortcuts |
42+
| `w` | Add box |
43+
| `d` | Toggle difficult |
44+
| `s` | Switch to the next label |
45+
| `tab` | Select next largest box |
46+
| `del` | Delete current box |
47+
| `esc` | Deselect/Cancel |
48+
| `← ↑ → ↓` | Move box |
49+
| `Shift + ← ↑ → ↓` | Resize box |
50+
| `scrollwheel` | Zoom in/out |
51+
| `f` | Hide/show all but current box |
52+
| `spacebar` | Verify and save |

0 commit comments

Comments
 (0)