Skip to content

Commit 305b576

Browse files
authored
Merge branch 'blakeblackshear:dev' into testing
2 parents ac8a77b + 207d1d2 commit 305b576

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2255
-721
lines changed

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
services:
22
devcontainer:
33
container_name: frigate-devcontainer
4-
# add groups from host for render, plugdev, video
4+
# Check host system's actual render/video/plugdev group IDs with 'getent group render', 'getent group video', and 'getent group plugdev'
5+
# Must add these exact IDs in container's group_add section or OpenVINO GPU acceleration will fail
56
group_add:
67
- "109" # render
78
- "110" # render
@@ -35,6 +36,7 @@ services:
3536
# - /dev/bus/usb:/dev/bus/usb # Uncomment for Google Coral USB
3637
mqtt:
3738
container_name: mqtt
38-
image: eclipse-mosquitto:1.6
39+
image: eclipse-mosquitto:2.0
40+
command: mosquitto -c /mosquitto-no-auth.conf # enable no-auth mode
3941
ports:
40-
- "1883:1883"
42+
- "1883:1883"

docker/main/build_nginx.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
set -euxo pipefail
44

5-
NGINX_VERSION="1.25.3"
5+
NGINX_VERSION="1.27.4"
66
VOD_MODULE_VERSION="1.31"
77
SECURE_TOKEN_MODULE_VERSION="1.5"
88
SET_MISC_MODULE_VERSION="v0.33"

docker/main/rootfs/usr/local/nginx/conf/nginx.conf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ http {
3030

3131
gzip on;
3232
gzip_comp_level 6;
33-
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/javascript image/svg+xml image/x-icon image/bmp image/png image/gif image/jpeg image/jpg;
33+
gzip_types text/plain text/css application/json application/x-javascript application/javascript text/javascript image/svg+xml image/x-icon image/bmp;
3434
gzip_proxied no-cache no-store private expired auth;
3535
gzip_vary on;
3636

docker/tensorrt/Dockerfile.base

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,20 @@ RUN --mount=type=bind,source=docker/tensorrt/detector/tensorrt_libyolo.sh,target
2121
RUN mkdir -p /usr/local/cuda-deps
2222
RUN if [ "$TARGETARCH" = "amd64" ]; then \
2323
cp /usr/local/cuda-12.3/targets/x86_64-linux/lib/libcurand.so.* /usr/local/cuda-deps/ && \
24-
cp /usr/local/cuda-12.3/targets/x86_64-linux/lib/libnvrtc.so.* /usr/local/cuda-deps/ ; \
24+
cp /usr/local/cuda-12.3/targets/x86_64-linux/lib/libnvrtc.so.* /usr/local/cuda-deps/ && \
25+
cd /usr/local/cuda-deps/ && \
26+
for lib in libnvrtc.so.*; do \
27+
if [[ "$lib" =~ libnvrtc.so\.([0-9]+\.[0-9]+\.[0-9]+) ]]; then \
28+
version="${BASH_REMATCH[1]}"; \
29+
ln -sf "libnvrtc.so.$version" libnvrtc.so; \
30+
fi; \
31+
done && \
32+
for lib in libcurand.so.*; do \
33+
if [[ "$lib" =~ libcurand.so\.([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+) ]]; then \
34+
version="${BASH_REMATCH[1]}"; \
35+
ln -sf "libcurand.so.$version" libcurand.so; \
36+
fi; \
37+
done; \
2538
fi
2639

2740
# Frigate w/ TensorRT Support as separate image
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/usr/local/lib
22
/usr/local/cuda
3+
/usr/local/lib/python3.11/dist-packages/tensorrt
34
/usr/local/lib/python3.11/dist-packages/nvidia/cudnn/lib
45
/usr/local/lib/python3.11/dist-packages/nvidia/cuda_runtime/lib
56
/usr/local/lib/python3.11/dist-packages/nvidia/cublas/lib
6-
/usr/local/lib/python3.11/dist-packages/nvidia/cuda_nvrtc/lib
7-
/usr/local/lib/python3.11/dist-packages/tensorrt
87
/usr/local/lib/python3.11/dist-packages/nvidia/cufft/lib
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
id: bird_classification
3+
title: Bird Classification
4+
---
5+
6+
Bird classification identifies known birds using a quantized Tensorflow model. When a known bird is recognized, its common name will be added as a `sub_label`. This information is included in the UI, filters, as well as in notifications.
7+
8+
## Minimum System Requirements
9+
10+
Bird classification runs a lightweight tflite model on the CPU, there are no significantly different system requirements than running Frigate itself.
11+
12+
## Model
13+
14+
The classification model used is the MobileNet INat Bird Classification, [available identifiers can be found here.](https://raw.githubusercontent.com/google-coral/test_data/master/inat_bird_labels.txt)
15+
16+
## Configuration
17+
18+
Bird classification is disabled by default, it must be enabled in your config file before it can be used. Bird classification is a global configuration setting.
19+
20+
```yaml
21+
classification:
22+
bird:
23+
enabled: true
24+
```
25+
26+
## Advanced Configuration
27+
28+
Fine-tune bird classification with these optional parameters:
29+
30+
- `threshold`: Classification confidence score required to set the sub label on the object.
31+
- Default: `0.9`.

docs/docs/configuration/face_recognition.md

Lines changed: 35 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,26 @@ Face recognition identifies known individuals by matching detected faces with pr
77

88
## Model Requirements
99

10-
Frigate has support for CV2 Local Binary Pattern Face Recognizer to recognize faces, which runs locally. A lightweight face landmark detection model is also used to align faces before running them through the face recognizer.
10+
### Face Detection
1111

12-
Users running a Frigate+ model (or any custom model that natively detects faces) should ensure that `face` is added to the [list of objects to track](../plus/#available-label-types) either globally or for a specific camera. This will allow face detection to run at the same time as object detection and be more efficient.
12+
When running a Frigate+ model (or any custom model that natively detects faces) should ensure that `face` is added to the [list of objects to track](../plus/#available-label-types) either globally or for a specific camera. This will allow face detection to run at the same time as object detection and be more efficient.
1313

14-
Users without a model that detects faces can still run face recognition. Frigate uses a lightweight DNN face detection model that runs on the CPU. In this case, you should _not_ define `face` in your list of objects to track.
14+
When running a default COCO model or another model that does not include `face` as a detectable label, face detection will run via CV2 using a lightweight DNN model that runs on the CPU. In this case, you should _not_ define `face` in your list of objects to track.
1515

16-
:::note
16+
### Face Recognition
1717

18-
Frigate needs to first detect a `face` before it can recognize a face.
18+
Frigate has support for two face recognition model types:
1919

20-
:::
20+
- **small**: Frigate will run a FaceNet embedding model to recognize faces, which runs locally on the CPU. This model is optimized for efficiency and is not as accurate.
21+
- **large**: Frigate will run a large ArcFace embedding model that is optimized for accuracy. It is only recommended to be run when an integrated or dedicated GPU is available.
22+
23+
In both cases, a lightweight face landmark detection model is also used to align faces before running recognition.
2124

2225
## Minimum System Requirements
2326

24-
Face recognition is lightweight and runs on the CPU, there are no significantly different system requirements than running Frigate itself.
27+
The `small` model is optimized for efficiency and runs on the CPU, most CPUs should run the model efficiently.
28+
29+
The `large` model is optimized for accuracy, an integrated or discrete GPU is highly recommended.
2530

2631
## Configuration
2732

@@ -47,12 +52,15 @@ Fine-tune face recognition with these optional parameters:
4752

4853
### Recognition
4954

55+
- `model_size`: Which model size to use, options are `small` or `large`
56+
- `unknown_score`: Min score to mark a person as a potential match, matches at or below this will be marked as unknown.
57+
- Default: `0.8`.
5058
- `recognition_threshold`: Recognition confidence score required to add the face to the object as a sub label.
5159
- Default: `0.9`.
5260
- `blur_confidence_filter`: Enables a filter that calculates how blurry the face is and adjusts the confidence based on this.
5361
- Default: `True`.
5462

55-
## Dataset
63+
## Creating a Robust Training Set
5664

5765
The number of images needed for a sufficient training set for face recognition varies depending on several factors:
5866

@@ -61,11 +69,9 @@ The number of images needed for a sufficient training set for face recognition v
6169

6270
However, here are some general guidelines:
6371

64-
- Minimum: For basic face recognition tasks, a minimum of 10-20 images per person is often recommended.
65-
- Recommended: For more robust and accurate systems, 30-50 images per person is a good starting point.
66-
- Ideal: For optimal performance, especially in challenging conditions, 100 or more images per person can be beneficial.
67-
68-
## Creating a Robust Training Set
72+
- Minimum: For basic face recognition tasks, a minimum of 5-10 images per person is often recommended.
73+
- Recommended: For more robust and accurate systems, 20-30 images per person is a good starting point.
74+
- Ideal: For optimal performance, especially in challenging conditions, 50-100 images per person can be beneficial.
6975

7076
The accuracy of face recognition is heavily dependent on the quality of data given to it for training. It is recommended to build the face training library in phases.
7177

@@ -76,8 +82,9 @@ When choosing images to include in the face training set it is recommended to al
7682
- If it is difficult to make out details in a persons face it will not be helpful in training.
7783
- Avoid images with extreme under/over-exposure.
7884
- Avoid blurry / pixelated images.
79-
- Be careful when uploading images of people when they are wearing clothing that covers a lot of their face as this may confuse the model.
80-
- Do not upload too many similar images at the same time, it is recommended to train no more than 4-6 similar images for each person to avoid overfitting.
85+
- Avoid training on infrared (gray-scale). The models are trained on color images and will be able to extract features from gray-scale images.
86+
- Using images of people wearing hats / sunglasses may confuse the model.
87+
- Do not upload too many similar images at the same time, it is recommended to train no more than 4-6 similar images for each person to avoid over-fitting.
8188

8289
:::
8390

@@ -87,7 +94,7 @@ When first enabling face recognition it is important to build a foundation of st
8794

8895
Then it is recommended to use the `Face Library` tab in Frigate to select and train images for each person as they are detected. When building a strong foundation it is strongly recommended to only train on images that are straight-on. Ignore images from cameras that recognize faces from an angle.
8996

90-
Aim to strike a balance between the quality of images while also having a range of conditions (day / night, different weather conditions, different times of day, etc.) in order to have diversity in the images used for each person and not have overfitting.
97+
Aim to strike a balance between the quality of images while also having a range of conditions (day / night, different weather conditions, different times of day, etc.) in order to have diversity in the images used for each person and not have over-fitting.
9198

9299
Once a person starts to be consistently recognized correctly on images that are straight-on, it is time to move on to the next step.
93100

@@ -97,13 +104,22 @@ Once straight-on images are performing well, start choosing slightly off-angle i
97104

98105
## FAQ
99106

100-
### Why is every face tagged as a known face and not unknown?
107+
### Why can't I bulk upload photos?
101108

102-
Any recognized face with a score >= `min_score` will show in the `Train` tab along with the recognition score. A low scoring face is effectively the same as `unknown`, but includes more information. This does not mean the recognition is not working well, and is part of the importance of choosing the correct `recognition_threshold`.
109+
It is important to methodically add photos to the library, bulk importing photos (especially from a general photo library) will lead to over-fitting in that particular scenario and hurt recognition performance.
110+
111+
### Why can't I bulk reprocess faces?
112+
113+
Face embedding models work by breaking apart faces into different features. This means that when reprocessing an image, only images from a similar angle will have its score affected.
103114

104115
### Why do unknown people score similarly to known people?
105116

106-
This can happen for a few different reasons, but this is usually an indicator that the training set needs to be improved. This is often related to overfitting:
117+
This can happen for a few different reasons, but this is usually an indicator that the training set needs to be improved. This is often related to over-fitting:
118+
107119
- If you train with only a few images per person, especially if those images are very similar, the recognition model becomes overly specialized to those specific images.
108120
- When you provide images with different poses, lighting, and expressions, the algorithm extracts features that are consistent across those variations.
109121
- By training on a diverse set of images, the algorithm becomes less sensitive to minor variations and noise in the input image.
122+
123+
### I see scores above the threshold in the train tab, but a sub label wasn't assigned?
124+
125+
The Frigate considers the recognition scores across all recognition attempts for each person object. The scores are continually weighted based on the area of the face, and a sub label will only be assigned to person if a person is confidently recognized consistently. This avoids cases where a single high confidence recognition would throw off the results.

0 commit comments

Comments
 (0)