Skip to content

Frigate Notebook 概念驗證

Frigate Notebook 概念驗證 — 人物、人臉與車牌偵測

Section titled “Frigate Notebook 概念驗證 — 人物、人臉與車牌偵測”

目的: 在購買專用路旁 ANPR 攝影機之前,先在 Windows Notebook 上測試 Frigate
平台: Windows 11 Notebook
目標: 驗證軟件技術棧能否從攝影機 / 影片來源中偵測人物、選擇性辨識已知人臉,以及辨識車牌
狀態: Proof of Concept(POC,概念驗證)
日期: 2026 年 10 月


  1. 簡介
  2. 這個概念驗證要測試甚麼
  3. 這個 POC 不會測試甚麼
  4. POC 架構
  5. 建議測試順序
  6. 硬件與軟件需求
  7. Windows 與 Frigate 的重要說明
  8. Step 1 — 安裝 Docker Desktop
  9. Step 2 — 建立 Frigate 專案資料夾
  10. Step 3 — 建立 Docker Compose
  11. Step 4 — 啟動 Frigate
  12. Step 5 — 準備攝影機串流
  13. Option A — 使用 Notebook Webcam
  14. Option B — 使用已錄製的車輛影片
  15. Option C — 使用 IP / RTSP Camera
  16. Step 6 — 將攝影機加入 Frigate
  17. Step 7 — 測試人物偵測
  18. Step 8 — 啟用人臉辨識
  19. Step 9 — 建立已知人臉資料
  20. Step 10 — 啟用車牌辨識
  21. Step 11 — 測試車牌辨識
  22. 建議的 Frigate LPR 設定
  23. 如何測試紐西蘭車牌
  24. 如何量度準確度
  25. 建議 POC 測試矩陣
  26. 預期限制
  27. 疑難排解
  28. POC 成功標準
  29. POC 完成後下一步
  30. 建議資料夾結構
  31. 常用指令
  32. 私隱注意事項
  33. 參考連結
  34. 最終建議流程

這個 Proof of Concept 是較大型路旁車輛保安專案的第一個軟件實驗。

長遠目標是建立一個或多個遠端路旁攝影機節點,可以:

  • 偵測車輛;
  • 讀取車牌;
  • 記錄時間與行車方向;
  • 偵測事件附近出現的人物;
  • 選擇性保留有用的人臉影像;
  • 在發生偷車或其他保安事件後進行搜尋。

最終的路旁系統可能包括:

ANPR camera
+ optional overview/person camera
+ solar panel
+ LiFePO4 battery
+ 4G/LTE router
+ weatherproof enclosure
+ central server

不過,如果未測試軟件就先購買並建立所有硬件,會增加不必要的成本與風險。

所以這個 Notebook POC 的目的,是回答:

Frigate 能否使用簡單的攝影機 / 影片輸入,成功偵測人物、選擇性辨識已知人臉,以及辨識車牌?

這個 POC 刻意先使用現有 Notebook,而不是立即購買最終的 ANPR 攝影機。


這個 POC 會分別測試三項功能。

當有人走到測試攝影機前面時,系統應能偵測到:

person

預期輸出:

Person detected
Timestamp recorded
Event appears in Frigate
Snapshot available

也就是:

  • 偵測到人物;
  • 記錄時間;
  • Frigate 內出現事件;
  • 可以查看 snapshot。

這是可選功能,只應在人類偵測已經正常運作後測試。

POC 應驗證 Frigate 能否做到:

Person detected
|
Face detected
|
Face embedding
|
Known person?

例如:

Harry
Confidence: 92%

或者:

Unknown

進行 POC 時,只應使用你自己的人臉,或者已明確同意參與測試的人士。


系統應該可以處理車輛圖片或影片,並嘗試輸出:

ABC123

以及相應的 recognition confidence。

第一輪車牌測試不需要真正的路旁 ANPR 攝影機。

可以先使用:

  • 已錄製的車輛影片;
  • 手機影片;
  • IP camera;
  • 之後再使用專用 ANPR camera。

Notebook POC 不能可靠代表最終路旁攝影機的實際表現。

Notebook webcam 無法真實模擬:

30–50 km/h moving vehicles
night-time conditions
headlights
retroreflective plates
10–30 metre capture distance
rain
roadside mounting angle
850 nm IR illumination

所以:

Notebook 上成功偵測,代表軟件 pipeline 可以運作。這不代表未來路旁攝影機在夜間一定能清楚擷取車牌。

之後仍然需要對專用路旁 ANPR camera 做獨立的 optical test。


整體 Notebook POC:

WINDOWS 11 NOTEBOOK
|
+----------+----------+
| |
v v
Docker Desktop MediaMTX
| |
v |
Frigate <-------- RTSP --+
|
+-------+--------+--------+
| | |
v v v
Person Face LPR
Detection Recognition

可能的影片來源:

Notebook webcam
Recorded MP4
IP / RTSP camera

按以下順序測試:

1. Install Docker Desktop
|
2. Start Frigate
|
3. Create an RTSP test stream
|
4. Confirm live video
|
5. Confirm person detection
|
6. Enable face recognition
|
7. Test your own known face
|
8. Feed a vehicle video
|
9. Enable LPR
|
10. Compare detected plate with actual plate

不要一開始就同時開啟所有功能。


建議最低配置:

Windows 11 notebook
4 GB RAM minimum for LPR
8 GB+ RAM preferable
Modern x86-64 CPU
AVX + AVX2 support
Webcam or test video
Internet for initial model downloads

GPU 會有幫助,但第一個 POC 不一定需要。

Frigate 可以先用 CPU detector 做測試,但正式長期部署較適合使用專用加速硬件。


安裝:

Docker Desktop
WSL2
Frigate
FFmpeg
MediaMTX

可選:

VLC
Visual Studio Code

Frigate 主要設計成以 Docker container 運作,而且在 bare-metal Debian-based Linux 系統上表現最佳。

作為臨時軟件 POC,在 Windows 上使用 Docker Desktop 是可以接受的。

但 Windows Docker 並不是建議的最終 production platform。

日後正式系統較適合:

Debian / Ubuntu
+
Docker Engine
+
Frigate

或其他受支援的 Linux host。

Windows 還有另一個問題:Notebook webcam。

直接把 Windows USB webcam pass-through 到 Linux Docker container 可能比較麻煩。

因此最簡單的 POC 方法是:

Windows webcam
|
FFmpeg
|
MediaMTX
|
RTSP
|
Frigate

這樣 Frigate 就會把 webcam 當成一般 IP camera。


下載並安裝 Docker Desktop for Windows。

安裝期間:

  • 啟用 WSL2 integration;
  • 允許 Docker 使用 WSL2 backend;
  • 如果安裝程式要求,重新啟動 Windows。

在 PowerShell 驗證:

Terminal window
docker --version

然後:

Terminal window
docker compose version

預期結果:

Docker version ...
Docker Compose version ...

9. Step 2 — 建立 Frigate 專案資料夾

Section titled “9. Step 2 — 建立 Frigate 專案資料夾”

例如:

Terminal window
mkdir C:\Users\harry\MyWorks\frigate-poc
cd C:\Users\harry\MyWorks\frigate-poc
mkdir config
mkdir storage

結果:

frigate-poc/
│
├── docker-compose.yml
├── config/
│ └── config.yml
│
└── storage/

建立:

docker-compose.yml

內容:

services:
frigate:
container_name: frigate
restart: unless-stopped
stop_grace_period: 30s
image: ghcr.io/blakeblackshear/frigate:stable
shm_size: "512mb"
volumes:
- ./config:/config
- ./storage:/media/frigate
tmpfs:
- /tmp/cache:size=1000000000
ports:
- "8971:8971"
- "8554:8554"
- "8555:8555/tcp"
- "8555:8555/udp"
environment:
FRIGATE_RTSP_PASSWORD: "change-this-password"

這個設定對 POC 而言刻意保持簡單。

不要把 Frigate 直接暴露到 public Internet。


在 PowerShell:

Terminal window
cd C:\Users\harry\MyWorks\frigate-poc
docker compose up -d

檢查狀態:

Terminal window
docker ps

查看 Frigate log:

Terminal window
docker logs frigate

第一次啟動時,Frigate 會建立 admin login。

開啟:

https://localhost:8971

瀏覽器可能會警告本機產生的 HTTPS certificate。

對本地 POC 而言,這是正常的。

使用 container log 顯示的 administrator credentials 登入。


Frigate 一般預期接收 network video stream。

這個 POC 有三個簡單選擇:

A. Notebook webcam
B. Recorded MP4
C. Existing IP / RTSP camera

Option C 最接近將來正式系統。

Option A 最方便測人物與人臉。

Option B 最適合做可重複的車牌測試。


安裝 Windows 版 FFmpeg,並確認:

Terminal window
ffmpeg -version

可以正常執行。


下載 Windows build 的 MediaMTX。

例如解壓到:

C:\Tools\mediamtx\

MediaMTX 是一個輕量本地 media server。

它可以讓 FFmpeg 把 webcam 發佈成 RTSP stream。


執行:

Terminal window
ffmpeg -list_devices true -f dshow -i dummy

找類似:

Integrated Camera

或者:

USB2.0 HD UVC WebCam

複製完全相同的 device name。


開啟:

mediamtx.yml

加入類似設定:

paths:
webcam:
runOnInit: ffmpeg -f dshow -i video="Integrated Camera" -c:v libx264 -pix_fmt yuv420p -preset ultrafast -b:v 1500k -f rtsp rtsp://localhost:$RTSP_PORT/$MTX_PATH
runOnInitRestart: yes

把:

Integrated Camera

換成你實際的 webcam device name。


執行:

Terminal window
mediamtx.exe

Webcam stream 應該變成:

rtsp://localhost:8554/webcam

開啟 VLC:

Media
→ Open Network Stream

輸入:

rtsp://localhost:8554/webcam

如果可以看到 Notebook webcam,代表 stream 已準備好給 Frigate 使用。


14. Option B — 使用已錄製的車輛影片

Section titled “14. Option B — 使用已錄製的車輛影片”

這非常適合車牌測試,因為同一段 clip 可以不停重播。

例如:

C:\Users\harry\Videos\anpr-test\night-car.mp4

啟動 MediaMTX。

然後 publish 檔案:

Terminal window
ffmpeg -re -stream_loop -1 -i "C:\Users\harry\Videos\anpr-test\night-car.mp4" -c copy -f rtsp rtsp://localhost:8554/testcar

如果 -c copy 有 codec 問題,改用:

Terminal window
ffmpeg -re -stream_loop -1 -i "C:\Users\harry\Videos\anpr-test\night-car.mp4" -c:v libx264 -an -f rtsp rtsp://localhost:8554/testcar

得到的 stream:

rtsp://localhost:8554/testcar

加入 Frigate 前,先用 VLC 測試。


如果現有 CCTV 或 IP camera 支援 RTSP,會更加直接。

例如:

rtsp://username:[email protected]:554/stream

實際 URL 視乎 camera manufacturer。

先用 VLC 測試。

如果 VLC 可以正常播放,一般都比較容易加入 Frigate。


Frigate 現時 UI 內有 Add Camera wizard。

使用:

Settings
→ Global configuration
→ Camera management
→ Add Camera

Notebook webcam RTSP stream 要使用 Frigate container 能夠存取的 MediaMTX address。

在 Docker Desktop 中,container 裡面的 localhost 是 container 自己,不是 Windows host。

Windows Docker 常用的 host address:

host.docker.internal

所以可以嘗試:

rtsp://host.docker.internal:8554/webcam

已錄製的車輛 stream:

rtsp://host.docker.internal:8554/testcar

如果是真正 IP camera:

rtsp://user:password@CAMERA_IP/...

加入後確認:

Live view works
No continuous FFmpeg errors
Video updates normally

先保持簡單。

POC 可以使用 Frigate 的 CPU detector。

最小 detector 設定:

detectors:
cpu1:
type: cpu
num_threads: 3

然後把 webcam camera 設成追蹤:

person

在 UI:

Settings
→ Camera configuration
→ Objects
→ Objects to track
→ person

然後在 Notebook camera 前走過。

預期:

person bounding box
person event
timestamp
snapshot

如果 person detection 成功,代表 object detection 部分 POC 已成功。


Frigate face recognition 預設是關閉的。

前往:

Settings
→ Enrichments
→ Face recognition

啟用。

Notebook POC 先選:

Model size: small

small model 適合 CPU 執行。

等效 YAML:

face_recognition:
enabled: true
model_size: small
detection_threshold: 0.7
min_area: 750

Frigate 必須先偵測到 person,之後才會做人臉偵測與辨識。

所以流程:

person detection
↓
face detection
↓
face recognition

使用:

Face Library
→ Add Face

先加入幾張清楚圖片。

建議:

front-facing
good lighting
not blurry
face reasonably large

例如:

Harry
├── front
├── slight-left
└── slight-right

不要一次上載很多低質素圖片。

少量但清楚、角度有變化的相片,比大量幾乎相同的相片更有用。

之後再站在 webcam 前面。

預期:

person detected
↓
face detected
↓
Harry

如果 confidence 不足:

Unknown

可以利用 Face Library training workflow,再加入高質素樣本改善模型。


前往:

Settings
→ Enrichments
→ License plate recognition

啟用 LPR。

建議第一輪設定:

Enabled: Yes
Device: CPU
Model size: small
Detection threshold: 0.7
Recognition threshold: 0.9
Minimum plate length: 4
Save debug plates: Yes

等效 YAML:

lpr:
enabled: true
device: CPU
model_size: small
detection_threshold: 0.7
recognition_threshold: 0.9
min_plate_length: 4
debug_save_plates: true

當主要 object model 本身沒有 plate detection 功能時,Frigate 內建 LPR 可以使用:

YOLOv9 plate detection
+
PaddleOCR

最容易重複測試的方法,是使用已錄製車輛影片。

使用一段符合以下條件的影片:

vehicle clearly visible
plate visible
plate reasonably large
minimal motion blur

用 MediaMTX publish:

night-car.mp4
|
FFmpeg
|
MediaMTX
|
RTSP
|
Frigate

正常 Frigate LPR 操作中,車輛應先被偵測為:

car

或者其他支援的 vehicle class。

之後 Frigate 會嘗試找出並讀取車牌。

檢查:

Explore
Review / History
Tracked object details
Recognized licence plate

先使用較保守設定:

lpr:
enabled: true
device: CPU
model_size: small
detection_threshold: 0.7
recognition_threshold: 0.9
min_plate_length: 4
debug_save_plates: true

如果 detection 失敗,不要立即把所有 threshold 大幅降低。

先檢查 debug plate crops。

問自己:

Did Frigate find the plate?
Is the crop sharp?
Can I read the plate manually?
Is the plate large enough?

這樣可以分辨:

capture problem
plate detection problem
OCR problem

建立一組小型 benchmark dataset。

例如:

data/
video/
car-001.mp4
car-002.mp4
car-003.mp4
ground-truth.csv

例如:

video,actual_plate
car-001.mp4,ABC123
car-002.mp4,XYZ789
car-003.mp4,DEF456

然後記錄:

video,actual_plate,frigate_plate,correct,confidence
car-001.mp4,ABC123,ABC123,true,0.97
car-002.mp4,XYZ789,XYZ7B9,false,0.91
car-003.mp4,DEF456,DEF456,true,0.96

不要只用一個車牌就判斷軟件表現。

第一個有意義的測試,建議至少:

20–50 test vehicles

之後更完整測試可以使用:

100–200 vehicles

不同指標要分開量度。

Readable plates / total vehicles

例如:

47 readable / 50 vehicles
= 94%
Plate crops detected / readable plates
Correct OCR / detected readable plates

完整車牌必須完全相同:

ABC123 == ABC123

只錯一個字元都計作 incorrect。

量度:

person events detected / actual person appearances

量度:

correct identity matches
false unknowns
false identity matches

其中 false identity match 尤其重要。


測試預期結果
在 webcam 前走過Person detected
面向 camera 站定Face detected
已登記 known face影像質素足夠時辨識到正確名字
Unknown person不應高信心地誤認成另一個 known person
清楚靜態車牌Plate recognized
日間車輛影片如畫面夠清楚,應辨識到車牌
低解像車牌準確度可能下降
模糊車牌準確度可能下降
夜間手機影片只作測試,不等同專用 ANPR camera
重播相同影片每次結果應大致一致

適合:

person detection
face testing
basic Frigate testing

不適合:

moving roadside plates
night vehicles
headlight glare
long distance

適合:

POC
one camera
low/moderate detect FPS

不適合:

many cameras
high-resolution continuous AI
production deployment

準確度會受以下因素影響:

  • face angle;
  • lighting;
  • blur;
  • distance;
  • face size;
  • glasses;
  • hats;
  • partial occlusion。

人臉辨識應視為 probabilistic,而不是百分百確定。

準確度會受:

  • plate pixel size;
  • blur;
  • viewing angle;
  • reflections;
  • headlights;
  • overexposure;
  • dirt;
  • plate design;
  • compression;

影響。


檢查:

Terminal window
docker logs frigate

仔細檢查 YAML indentation。


檢查:

Terminal window
docker ps

然後:

https://localhost:8971

除非 MediaMTX 與 Frigate 在相同 container/network 內,否則不要在 Docker container 裡使用:

rtsp://localhost:8554/webcam

改試:

rtsp://host.docker.internal:8554/webcam

先用 VLC 驗證:

rtsp://localhost:8554/webcam

如果 VLC 都讀不到,先修正 FFmpeg / MediaMTX,之後才處理 Frigate。


執行:

Terminal window
ffmpeg -list_devices true -f dshow -i dummy

使用完全相同的 video-device name。


降低:

detect FPS
resolution
number of active features

例如:

detect:
fps: 5

對這個 POC,5 FPS 已足夠做基本 person detection 測試。


檢查:

Is person detection working first?
Is the face large enough?
Is face recognition globally enabled?

Frigate 要先偵測到人物,才會做人臉辨識。


檢查:

Is LPR globally enabled?
Is a supported vehicle being detected?
Is the plate large enough?
Can you read the plate yourself?

啟用:

debug_save_plates: true

並檢查保存的 crop。


常見例子:

0 ↔ O
1 ↔ I
5 ↔ S
8 ↔ B

不要立即自動修正。

先保存:

raw OCR
confidence
actual plate

之後再仔細建立 NZ-specific normalisation。


Notebook POC 符合以下條件,就可以視為成功。

  • Frigate 能在 Docker 穩定啟動;
  • Browser UI 可以正常開啟;
  • 可以看到 test RTSP stream。
  • 在 webcam 前走過會產生 person detection;
  • 事件會出現在 Frigate;
  • 可以取得有用 snapshot。

可選:

  • Frigate 在偵測到 person 後能夠偵測 face;
  • 在良好條件下,可以辨識已加入的自己;
  • Unknown person 不應被錯誤當成 known identity。
  • Frigate 在 test clip 內能偵測到車輛;
  • 能找到車牌;
  • 產生 OCR result;
  • 可以查看 debug plate images;
  • 至少能正確辨識數個清楚的 NZ plates。

這個階段目的不是達到 production accuracy。

而是證明:

video
|
Frigate
|
AI detection
|
useful structured result

Notebook POC 成功後:

購買或借用一部真正 ANPR camera。

測試:

night
30–50 km/h
headlights
10–20 m
IR

把真正 camera 連到 Frigate:

ANPR camera
|
RTSP
|
Frigate

比較:

Frigate LPR
vs
camera-native ANPR

寫一個自訂 Python comparison:

YOLO
+
PaddleOCR

使用完全相同的 video dataset 比較結果。

只有當 recognition 已可靠,才建立:

solar
battery
MPPT
4G/LTE
weatherproof box

作為 roadside prototype。


frigate-poc/
│
├── docker-compose.yml
│
├── config/
│ └── config.yml
│
├── storage/
│
├── test-data/
│ ├── videos/
│ │ ├── daytime/
│ │ └── night/
│ │
│ ├── plates/
│ └── ground-truth.csv
│
├── notes/
│ └── test-results.md
│
└── scripts/
└── start-test-stream.ps1

啟動 Frigate:

Terminal window
docker compose up -d

停止 Frigate:

Terminal window
docker compose down

重新啟動:

Terminal window
docker compose restart

Logs:

Terminal window
docker logs -f frigate

列出 containers:

Terminal window
docker ps

列出 webcam devices:

Terminal window
ffmpeg -list_devices true -f dshow -i dummy

透過 RTSP 重播 MP4:

Terminal window
ffmpeg -re -stream_loop -1 -i test.mp4 -c:v libx264 -an -f rtsp rtsp://localhost:8554/testcar

這個 POC:

  • 盡量使用自己的人臉做人臉辨識測試;
  • 加入其他人的臉之前先取得同意;
  • 不要建立陌生人的 face database;
  • 不要公開擷取到的人臉或車牌;
  • test data 保持在本機;
  • 不再需要時刪除 test data。

Person detection 與 identity recognition 是不同的事情。

這個 POC 最好停留在:

person detection
+
optional face recognition of consenting test subjects

然後才決定真實世界部署是否需要更多功能。

涉及 biometric identification 的 roadside deployment,需要另外做 privacy 與 legal review。


主要文件:

https://docs.frigate.video/

安裝:

https://docs.frigate.video/frigate/installation/

Getting started:

https://docs.frigate.video/guides/getting_started/

Configuration:

https://docs.frigate.video/configuration/config/

Camera configuration:

https://docs.frigate.video/configuration/cameras/

Object detectors:

https://docs.frigate.video/configuration/object_detectors/

Licence Plate Recognition:

https://docs.frigate.video/configuration/license_plate_recognition/

Face Recognition:

https://docs.frigate.video/configuration/face_recognition/

go2rtc:

https://docs.frigate.video/configuration/go2rtc/


主要文件:

https://mediamtx.org/docs/

Windows / generic webcam publishing:

https://mediamtx.org/docs/publish/generic-webcams

FFmpeg publishing:

https://mediamtx.org/docs/publish/ffmpeg


不要立即建立最終 roadside system。

按以下順序:

DAY 1
Windows notebook
|
Docker Desktop
|
Frigate starts

然後:

DAY 1–2
Notebook webcam
|
MediaMTX
|
RTSP
|
Frigate
|
person detection

然後:

NEXT
person
|
face detection
|
known-face test

然後:

NEXT
recorded car video
|
MediaMTX
|
Frigate
|
LPR

之後:

AFTER SOFTWARE POC
Dedicated ANPR camera
|
real daylight/night testing

最後才:

FINAL REMOTE POC
Roadside location
|
ANPR camera
|
optional overview camera
|
LiFePO4 battery
|
solar + MPPT
|
4G/LTE + VPN
|
Frigate / central server

Notebook POC 因此只有一個簡單目的:

在花錢購買路旁硬件之前,先用最低成本證明整個軟件 workflow 可行。