forked from Github/frigate
Compare commits
363 Commits
v0.12.0-be
...
update_cal
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
91ac4c4cee | ||
|
|
b85c488d7e | ||
|
|
fa6c6c50d0 | ||
|
|
4c7ea01137 | ||
|
|
34b315cc8c | ||
|
|
9b687d77ce | ||
|
|
e32bd4ab15 | ||
|
|
e19c0668e7 | ||
|
|
869bb2b177 | ||
|
|
3869b274e2 | ||
|
|
2379e6fd1b | ||
|
|
dcafcc1320 | ||
|
|
d508088bd0 | ||
|
|
97e5a98b95 | ||
|
|
68ebd55425 | ||
|
|
a82334ca1c | ||
|
|
d7ddcea951 | ||
|
|
cc6e049966 | ||
|
|
dbd21eb6fa | ||
|
|
e1a6398219 | ||
|
|
7f5fba08b7 | ||
|
|
c35e8371be | ||
|
|
49e7723405 | ||
|
|
52cc707eb8 | ||
|
|
c47b02d2fe | ||
|
|
3a460133d4 | ||
|
|
67a5a7d21a | ||
|
|
5d2b87e077 | ||
|
|
8298806028 | ||
|
|
8cc7acd591 | ||
|
|
8bde914939 | ||
|
|
fe9fcf3eaa | ||
|
|
20c2ab39bc | ||
|
|
08ef69bac4 | ||
|
|
79fabbb6b0 | ||
|
|
8941aa5311 | ||
|
|
14d2b79c72 | ||
|
|
9a4f970337 | ||
|
|
22b9507797 | ||
|
|
37379e6fba | ||
|
|
232588636f | ||
|
|
e77fedc445 | ||
|
|
ead03c381b | ||
|
|
0048cd5edc | ||
|
|
56dfcd7a32 | ||
|
|
9f3ac19e05 | ||
|
|
50f13b7196 | ||
|
|
50b17031c4 | ||
|
|
d11c1a2066 | ||
|
|
27144eb0b9 | ||
|
|
64705c065f | ||
|
|
08eefd8385 | ||
|
|
705ee54315 | ||
|
|
e26bb94007 | ||
|
|
1aba8c1ef5 | ||
|
|
f92237c9c1 | ||
|
|
0858859939 | ||
|
|
1c27ee2d2b | ||
|
|
08586f8f65 | ||
|
|
cfd04d164e | ||
|
|
fa2e4993d9 | ||
|
|
080d7a2d88 | ||
|
|
7d0216b8fb | ||
|
|
c743dfd657 | ||
|
|
4a6579527b | ||
|
|
fd9196ae3e | ||
|
|
a3eccce8f3 | ||
|
|
111933d3b4 | ||
|
|
76d4f16db3 | ||
|
|
0d6bb6714a | ||
|
|
5d30944d6e | ||
|
|
3797340efa | ||
|
|
8728139ae3 | ||
|
|
730851cda9 | ||
|
|
46412e99d9 | ||
|
|
e5664826b1 | ||
|
|
9a1c8b2cc4 | ||
|
|
6aedc39a9a | ||
|
|
b9e6afa659 | ||
|
|
9185753322 | ||
|
|
a1b50d2cf4 | ||
|
|
a2206bb177 | ||
|
|
5658e5a4cc | ||
|
|
2a0b8a78fe | ||
|
|
b80ff1aa3a | ||
|
|
f682203f9d | ||
|
|
a63af1a891 | ||
|
|
64fd5f8be3 | ||
|
|
6e35c97376 | ||
|
|
db6ee41f3c | ||
|
|
36434bb26d | ||
|
|
3c25c578f0 | ||
|
|
2e4f5bc0e0 | ||
|
|
bd0d16a75b | ||
|
|
7069ef93bb | ||
|
|
737681aa4f | ||
|
|
77cb469430 | ||
|
|
3e18d58921 | ||
|
|
de6a916939 | ||
|
|
45f7db5cf1 | ||
|
|
bbdf5e1bee | ||
|
|
b538572afb | ||
|
|
14048cb83e | ||
|
|
602041beb1 | ||
|
|
ef6b464d0e | ||
|
|
731743c7e5 | ||
|
|
f25bee7672 | ||
|
|
7c629c1874 | ||
|
|
6146afe8f7 | ||
|
|
c815f3c331 | ||
|
|
767abed7f0 | ||
|
|
28ea2afa51 | ||
|
|
3921a7faa2 | ||
|
|
4c63ad767a | ||
|
|
afe3b5dd3d | ||
|
|
fbed3fbb8b | ||
|
|
318ae28004 | ||
|
|
24365fb865 | ||
|
|
36ccaa4cff | ||
|
|
98576418a8 | ||
|
|
c2e2656407 | ||
|
|
e941012d48 | ||
|
|
7d3e5c9c4c | ||
|
|
b7ff6735f6 | ||
|
|
f57d21039e | ||
|
|
d0b38f0a47 | ||
|
|
b79b1d9443 | ||
|
|
947ccbc654 | ||
|
|
eaf7078d98 | ||
|
|
b42e995f0f | ||
|
|
f8c0f74ab8 | ||
|
|
f9d422b5b5 | ||
|
|
f0dda499f8 | ||
|
|
a96602f3f5 | ||
|
|
961ce03835 | ||
|
|
761daf46ea | ||
|
|
9016a48dc7 | ||
|
|
a96a951e23 | ||
|
|
680198148b | ||
|
|
dc44a6c3b4 | ||
|
|
157b160b9d | ||
|
|
d0413e3ea8 | ||
|
|
6a4f317403 | ||
|
|
8481ab3745 | ||
|
|
a8cef179e7 | ||
|
|
0fd1eaff43 | ||
|
|
d30a738960 | ||
|
|
bfa7a5cc60 | ||
|
|
b655eca152 | ||
|
|
f2ff55dba2 | ||
|
|
91aadb6044 | ||
|
|
c5b8d13beb | ||
|
|
dacf45cd88 | ||
|
|
c6d0e93157 | ||
|
|
662025a961 | ||
|
|
07155b1fa9 | ||
|
|
8e584cf844 | ||
|
|
d0873631cc | ||
|
|
dfd3fcdff6 | ||
|
|
00016b7499 | ||
|
|
5bb5e2dc5a | ||
|
|
dc2e786a6f | ||
|
|
598ae98bfe | ||
|
|
ce3a544ecd | ||
|
|
6ac36e8436 | ||
|
|
5c12762cb5 | ||
|
|
3a0c36e8db | ||
|
|
6adc810145 | ||
|
|
6d34f2229b | ||
|
|
b909ff4ecb | ||
|
|
2d52fbd8e8 | ||
|
|
c9254b256a | ||
|
|
7a2d09dc35 | ||
|
|
a94346e17e | ||
|
|
20415bb5e0 | ||
|
|
7c0d25f9da | ||
|
|
5e772c3625 | ||
|
|
691e9d26d2 | ||
|
|
f37f034b6a | ||
|
|
88fc0fac8f | ||
|
|
1fd23f86aa | ||
|
|
d6f82f9edc | ||
|
|
00b9a490bb | ||
|
|
5259d51c04 | ||
|
|
04aada8720 | ||
|
|
69630e7385 | ||
|
|
dd02958f7c | ||
|
|
30dfdf47d4 | ||
|
|
f48dd8c1ab | ||
|
|
22cc2712a6 | ||
|
|
cbb77e5794 | ||
|
|
baf671b764 | ||
|
|
606f00867e | ||
|
|
2fae9dcb93 | ||
|
|
3f509b6ff9 | ||
|
|
c38c981cd0 | ||
|
|
d0891e5183 | ||
|
|
325205740b | ||
|
|
f30ba25444 | ||
|
|
339b6944f1 | ||
|
|
0f68fbc8db | ||
|
|
998bffe706 | ||
|
|
12d4a47e3d | ||
|
|
1171f01683 | ||
|
|
f905704479 | ||
|
|
58c6ef1e12 | ||
|
|
83edf9574e | ||
|
|
c25367221e | ||
|
|
7ee17c7af8 | ||
|
|
c3b313a70d | ||
|
|
f1dc3a639c | ||
|
|
2f401bd8da | ||
|
|
8cb8a030be | ||
|
|
f3f9b36e07 | ||
|
|
0a8249d6fb | ||
|
|
b6fce8f0bb | ||
|
|
d51197eaa2 | ||
|
|
d2a2643cd6 | ||
|
|
bd17e7d824 | ||
|
|
ed0d2be321 | ||
|
|
9137f1594b | ||
|
|
ef14a43930 | ||
|
|
ee4a133655 | ||
|
|
ece070fee1 | ||
|
|
3d40ed5d47 | ||
|
|
e640981cc4 | ||
|
|
9e531b0b5b | ||
|
|
7c1568fcb9 | ||
|
|
09cc4251f0 | ||
|
|
793fe251b9 | ||
|
|
2be2050d57 | ||
|
|
0996883a98 | ||
|
|
b66810247e | ||
|
|
0592cedcde | ||
|
|
ca7853c087 | ||
|
|
3efa77f302 | ||
|
|
ff1b5c87aa | ||
|
|
a8f282515f | ||
|
|
730416418d | ||
|
|
7e5abe7a65 | ||
|
|
ec4d79eafc | ||
|
|
ff90db30e6 | ||
|
|
bd9942b426 | ||
|
|
dfd574beeb | ||
|
|
b359ff1b8e | ||
|
|
0f1cf67b91 | ||
|
|
d81dd60fef | ||
|
|
32569842d3 | ||
|
|
5c27cb7e9b | ||
|
|
7459a1cdde | ||
|
|
b160abac0d | ||
|
|
fd6eb78f41 | ||
|
|
8d941e5e26 | ||
|
|
8bc76d19db | ||
|
|
20b52a96bc | ||
|
|
367d7244d3 | ||
|
|
435d152423 | ||
|
|
d3949eebfa | ||
|
|
d1701e127e | ||
|
|
f0c1b66b0f | ||
|
|
699248d769 | ||
|
|
deec5b8bfd | ||
|
|
62f36b221e | ||
|
|
ae0aba44dc | ||
|
|
bd1d13d78c | ||
|
|
ab50d0b006 | ||
|
|
1e17dbaa91 | ||
|
|
f66ccb04f6 | ||
|
|
39bf6c44bc | ||
|
|
846a180a7b | ||
|
|
11738110dc | ||
|
|
53d63e0f75 | ||
|
|
deccc4fd46 | ||
|
|
4940826011 | ||
|
|
fec1dd3f46 | ||
|
|
42f3ee3de5 | ||
|
|
e357715a8c | ||
|
|
6d0c2ec5c8 | ||
|
|
17e8a46c7d | ||
|
|
76dbab6a8b | ||
|
|
b568a29fa8 | ||
|
|
b4038821cc | ||
|
|
6634be1f79 | ||
|
|
5fb96c777a | ||
|
|
181b53a55d | ||
|
|
5951a740d2 | ||
|
|
e3b9998879 | ||
|
|
f52b1212cd | ||
|
|
aded314f3c | ||
|
|
ede1dedbbd | ||
|
|
0751358e5b | ||
|
|
17b92aa657 | ||
|
|
0fcfcb85ab | ||
|
|
ef50af03f2 | ||
|
|
02f577347d | ||
|
|
03b45c153b | ||
|
|
2add675d42 | ||
|
|
305323c9e9 | ||
|
|
85015d9409 | ||
|
|
b38c9e82e2 | ||
|
|
82aa238eca | ||
|
|
19890310fe | ||
|
|
9bf98f908d | ||
|
|
ad52e238ce | ||
|
|
ca7790ff65 | ||
|
|
cbd07696b5 | ||
|
|
37360edbc1 | ||
|
|
df016ddd0d | ||
|
|
b48f6d750f | ||
|
|
83006eeb65 | ||
|
|
e451f44ced | ||
|
|
6dc82b6cef | ||
|
|
43ade86796 | ||
|
|
6bcf44aee8 | ||
|
|
0d16bd0144 | ||
|
|
9dca1e1d9f | ||
|
|
7f96d89ec4 | ||
|
|
04a22f8283 | ||
|
|
ece7dc29e7 | ||
|
|
cdd8e6fd4e | ||
|
|
fbaab71d78 | ||
|
|
83aad5262a | ||
|
|
3c72b96042 | ||
|
|
35ddc896fa | ||
|
|
ba6794fb99 | ||
|
|
7960090409 | ||
|
|
366c31259f | ||
|
|
9b109a7d14 | ||
|
|
03d37fe830 | ||
|
|
433bf690e3 | ||
|
|
c820badb40 | ||
|
|
98384789d4 | ||
|
|
75e0ed38eb | ||
|
|
8535213ad9 | ||
|
|
416ce66b51 | ||
|
|
cb73d0cd39 | ||
|
|
f8f76fcb94 | ||
|
|
149d6694d6 | ||
|
|
15415bab10 | ||
|
|
3b62ff093a | ||
|
|
a218d2f6ff | ||
|
|
6e0faa930a | ||
|
|
d6c9538859 | ||
|
|
dee471e9e9 | ||
|
|
e3eae53cb9 | ||
|
|
6986949d84 | ||
|
|
19a65eaaac | ||
|
|
cefbed614f | ||
|
|
37db4070ce | ||
|
|
da3e197534 | ||
|
|
0e61ea7723 | ||
|
|
f855b1a2b3 | ||
|
|
bc16ad1f13 | ||
|
|
1b8cd10142 | ||
|
|
83c80c570c | ||
|
|
4c5cd02ab7 | ||
|
|
7d589bd6e1 | ||
|
|
1bf3b83ef3 | ||
|
|
b61b6f46cd | ||
|
|
ac339d411c | ||
|
|
3f17f871fa | ||
|
|
a554b22968 | ||
|
|
13122fc2b1 |
@@ -37,42 +37,61 @@
|
|||||||
"onAutoForward": "silent"
|
"onAutoForward": "silent"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"extensions": [
|
"customizations": {
|
||||||
"ms-python.vscode-pylance",
|
"vscode": {
|
||||||
"ms-python.python",
|
"extensions": [
|
||||||
"visualstudioexptteam.vscodeintellicode",
|
"ms-python.python",
|
||||||
"mhutchie.git-graph",
|
"ms-python.vscode-pylance",
|
||||||
"ms-azuretools.vscode-docker",
|
"ms-python.black-formatter",
|
||||||
"streetsidesoftware.code-spell-checker",
|
"visualstudioexptteam.vscodeintellicode",
|
||||||
"esbenp.prettier-vscode",
|
"mhutchie.git-graph",
|
||||||
"dbaeumer.vscode-eslint",
|
"ms-azuretools.vscode-docker",
|
||||||
"mikestead.dotenv",
|
"streetsidesoftware.code-spell-checker",
|
||||||
"csstools.postcss",
|
"esbenp.prettier-vscode",
|
||||||
"blanu.vscode-styled-jsx",
|
"dbaeumer.vscode-eslint",
|
||||||
"bradlc.vscode-tailwindcss"
|
"mikestead.dotenv",
|
||||||
],
|
"csstools.postcss",
|
||||||
"settings": {
|
"blanu.vscode-styled-jsx",
|
||||||
"remote.autoForwardPorts": false,
|
"bradlc.vscode-tailwindcss",
|
||||||
"python.linting.pylintEnabled": true,
|
"ms-python.isort",
|
||||||
"python.linting.enabled": true,
|
"charliermarsh.ruff"
|
||||||
"python.formatting.provider": "black",
|
],
|
||||||
"python.languageServer": "Pylance",
|
"settings": {
|
||||||
"editor.formatOnPaste": false,
|
"remote.autoForwardPorts": false,
|
||||||
"editor.formatOnSave": true,
|
"python.linting.pylintEnabled": true,
|
||||||
"editor.formatOnType": true,
|
"python.linting.enabled": true,
|
||||||
"python.testing.pytestEnabled": false,
|
"python.formatting.provider": "none",
|
||||||
"python.testing.unittestEnabled": true,
|
"python.languageServer": "Pylance",
|
||||||
"python.testing.unittestArgs": ["-v", "-s", "./frigate/test"],
|
"editor.formatOnPaste": false,
|
||||||
"files.trimTrailingWhitespace": true,
|
"editor.formatOnSave": true,
|
||||||
"eslint.workingDirectories": ["./web"],
|
"editor.formatOnType": true,
|
||||||
"[json][jsonc]": {
|
"python.testing.pytestEnabled": false,
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"python.testing.unittestEnabled": true,
|
||||||
},
|
"python.testing.unittestArgs": ["-v", "-s", "./frigate/test"],
|
||||||
"[jsx][js][tsx][ts]": {
|
"files.trimTrailingWhitespace": true,
|
||||||
"editor.codeActionsOnSave": ["source.addMissingImports", "source.fixAll"],
|
"eslint.workingDirectories": ["./web"],
|
||||||
"editor.tabSize": 2
|
"isort.args": ["--settings-path=./pyproject.toml"],
|
||||||
},
|
"[python]": {
|
||||||
"cSpell.ignoreWords": ["rtmp"],
|
"editor.defaultFormatter": "ms-python.black-formatter",
|
||||||
"cSpell.words": ["preact"]
|
"editor.formatOnSave": true,
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": true,
|
||||||
|
"source.organizeImports": true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"[json][jsonc]": {
|
||||||
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
|
},
|
||||||
|
"[jsx][js][tsx][ts]": {
|
||||||
|
"editor.codeActionsOnSave": [
|
||||||
|
"source.addMissingImports",
|
||||||
|
"source.fixAll"
|
||||||
|
],
|
||||||
|
"editor.tabSize": 2
|
||||||
|
},
|
||||||
|
"cSpell.ignoreWords": ["rtmp"],
|
||||||
|
"cSpell.words": ["preact", "astype", "hwaccel", "mqtt"]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,23 @@
|
|||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
|
# Cleanup the old github host key
|
||||||
|
sed -i -e '/AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31\/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi\/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==/d' ~/.ssh/known_hosts
|
||||||
|
# Add new github host key
|
||||||
|
curl -L https://api.github.com/meta | jq -r '.ssh_keys | .[]' | \
|
||||||
|
sed -e 's/^/github.com /' >> ~/.ssh/known_hosts
|
||||||
|
|
||||||
# Frigate normal container runs as root, so it have permission to create
|
# Frigate normal container runs as root, so it have permission to create
|
||||||
# the folders. But the devcontainer runs as the host user, so we need to
|
# the folders. But the devcontainer runs as the host user, so we need to
|
||||||
# create the folders and give the host user permission to write to them.
|
# create the folders and give the host user permission to write to them.
|
||||||
sudo mkdir -p /media/frigate
|
sudo mkdir -p /media/frigate
|
||||||
sudo chown -R "$(id -u):$(id -g)" /media/frigate
|
sudo chown -R "$(id -u):$(id -g)" /media/frigate
|
||||||
|
|
||||||
|
# When started as a service, LIBAVFORMAT_VERSION_MAJOR is defined in the
|
||||||
|
# s6 service file. For dev, where frigate is started from an interactive
|
||||||
|
# shell, we define it in .bashrc instead.
|
||||||
|
echo 'export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po "libavformat\W+\K\d+")' >> $HOME/.bashrc
|
||||||
|
|
||||||
make version
|
make version
|
||||||
|
|
||||||
cd web
|
cd web
|
||||||
|
|||||||
39
.github/actions/setup/action.yml
vendored
Normal file
39
.github/actions/setup/action.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
name: 'Setup'
|
||||||
|
description: 'Set up QEMU and Buildx'
|
||||||
|
inputs:
|
||||||
|
GITHUB_TOKEN:
|
||||||
|
required: true
|
||||||
|
outputs:
|
||||||
|
image-name:
|
||||||
|
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ steps.create-short-sha.outputs.SHORT_SHA }}
|
||||||
|
cache-name:
|
||||||
|
value: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:cache
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Remove unnecessary files
|
||||||
|
run: |
|
||||||
|
sudo rm -rf /usr/share/dotnet
|
||||||
|
sudo rm -rf /usr/local/lib/android
|
||||||
|
sudo rm -rf /opt/ghc
|
||||||
|
shell: bash
|
||||||
|
- id: lowercaseRepo
|
||||||
|
uses: ASzc/change-string-case-action@v5
|
||||||
|
with:
|
||||||
|
string: ${{ github.repository }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v2
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v2
|
||||||
|
- name: Log in to the Container registry
|
||||||
|
uses: docker/login-action@465a07811f14bebb1938fbed4728c6a1ff8901fc
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ inputs.GITHUB_TOKEN }}
|
||||||
|
- name: Create version file
|
||||||
|
run: make version
|
||||||
|
shell: bash
|
||||||
|
- id: create-short-sha
|
||||||
|
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_OUTPUT
|
||||||
|
shell: bash
|
||||||
2
.github/dependabot.yml
vendored
2
.github/dependabot.yml
vendored
@@ -13,7 +13,7 @@ updates:
|
|||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
target-branch: dev
|
target-branch: dev
|
||||||
- package-ecosystem: "pip"
|
- package-ecosystem: "pip"
|
||||||
directory: "/"
|
directory: "/docker/main"
|
||||||
schedule:
|
schedule:
|
||||||
interval: daily
|
interval: daily
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
|||||||
165
.github/workflows/ci.yml
vendored
165
.github/workflows/ci.yml
vendored
@@ -1,6 +1,7 @@
|
|||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
@@ -15,53 +16,145 @@ env:
|
|||||||
PYTHON_VERSION: 3.9
|
PYTHON_VERSION: 3.9
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
multi_arch_build:
|
amd64_build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Image Build
|
name: AMD64 Build
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU and Buildx
|
||||||
|
id: setup
|
||||||
|
uses: ./.github/actions/setup
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build and push amd64 standard build
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: docker/main/Dockerfile
|
||||||
|
push: true
|
||||||
|
platforms: linux/amd64
|
||||||
|
target: frigate
|
||||||
|
tags: ${{ steps.setup.outputs.image-name }}-amd64
|
||||||
|
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64
|
||||||
|
- name: Build and push TensorRT (x86 GPU)
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
targets: tensorrt
|
||||||
|
files: docker/tensorrt/trt.hcl
|
||||||
|
set: |
|
||||||
|
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt
|
||||||
|
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64
|
||||||
|
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-amd64,mode=max
|
||||||
|
arm64_build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: ARM Build
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU and Buildx
|
||||||
|
id: setup
|
||||||
|
uses: ./.github/actions/setup
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build and push arm64 standard build
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: docker/main/Dockerfile
|
||||||
|
push: true
|
||||||
|
platforms: linux/arm64
|
||||||
|
target: frigate
|
||||||
|
tags: |
|
||||||
|
${{ steps.setup.outputs.image-name }}-standard-arm64
|
||||||
|
cache-from: type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64
|
||||||
|
- name: Build and push RPi build
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
targets: rpi
|
||||||
|
files: docker/rpi/rpi.hcl
|
||||||
|
set: |
|
||||||
|
rpi.tags=${{ steps.setup.outputs.image-name }}-rpi
|
||||||
|
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64
|
||||||
|
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-arm64,mode=max
|
||||||
|
jetson_jp4_build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Jetson Jetpack 4
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU and Buildx
|
||||||
|
id: setup
|
||||||
|
uses: ./.github/actions/setup
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build and push TensorRT (Jetson, Jetpack 4)
|
||||||
|
env:
|
||||||
|
ARCH: arm64
|
||||||
|
BASE_IMAGE: timongentzsch/l4t-ubuntu20-opencv:latest
|
||||||
|
SLIM_BASE: timongentzsch/l4t-ubuntu20-opencv:latest
|
||||||
|
TRT_BASE: timongentzsch/l4t-ubuntu20-opencv:latest
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
targets: tensorrt
|
||||||
|
files: docker/tensorrt/trt.hcl
|
||||||
|
set: |
|
||||||
|
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp4
|
||||||
|
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp4
|
||||||
|
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp4,mode=max
|
||||||
|
jetson_jp5_build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Jetson Jetpack 5
|
||||||
|
steps:
|
||||||
|
- name: Check out code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Set up QEMU and Buildx
|
||||||
|
id: setup
|
||||||
|
uses: ./.github/actions/setup
|
||||||
|
with:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Build and push TensorRT (Jetson, Jetpack 5)
|
||||||
|
env:
|
||||||
|
ARCH: arm64
|
||||||
|
BASE_IMAGE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime
|
||||||
|
SLIM_BASE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime
|
||||||
|
TRT_BASE: nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime
|
||||||
|
uses: docker/bake-action@v4
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
targets: tensorrt
|
||||||
|
files: docker/tensorrt/trt.hcl
|
||||||
|
set: |
|
||||||
|
tensorrt.tags=${{ steps.setup.outputs.image-name }}-tensorrt-jp5
|
||||||
|
*.cache-from=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp5
|
||||||
|
*.cache-to=type=registry,ref=${{ steps.setup.outputs.cache-name }}-jp5,mode=max
|
||||||
|
# The majority of users running arm64 are rpi users, so the rpi
|
||||||
|
# build should be the primary arm64 image
|
||||||
|
assemble_default_build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Assemble and push default build
|
||||||
|
needs:
|
||||||
|
- amd64_build
|
||||||
|
- arm64_build
|
||||||
steps:
|
steps:
|
||||||
- name: Remove unnecessary files
|
|
||||||
run: |
|
|
||||||
sudo rm -rf /usr/share/dotnet
|
|
||||||
sudo rm -rf /usr/local/lib/android
|
|
||||||
sudo rm -rf /opt/ghc
|
|
||||||
- id: lowercaseRepo
|
- id: lowercaseRepo
|
||||||
uses: ASzc/change-string-case-action@v5
|
uses: ASzc/change-string-case-action@v5
|
||||||
with:
|
with:
|
||||||
string: ${{ github.repository }}
|
string: ${{ github.repository }}
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Create version file
|
|
||||||
run: make version
|
|
||||||
- name: Create short sha
|
- name: Create short sha
|
||||||
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
||||||
- name: Build and push
|
- uses: int128/docker-manifest-create-action@v1
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
with:
|
||||||
context: .
|
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
|
||||||
push: true
|
suffixes: |
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
-amd64
|
||||||
target: frigate
|
-rpi
|
||||||
tags: |
|
|
||||||
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
|
|
||||||
cache-from: type=gha
|
|
||||||
cache-to: type=gha,mode=max
|
|
||||||
- name: Build and push TensorRT
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
platforms: linux/amd64
|
|
||||||
target: frigate-tensorrt
|
|
||||||
tags: |
|
|
||||||
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-tensorrt
|
|
||||||
cache-from: type=gha
|
|
||||||
|
|||||||
4
.github/workflows/dependabot-auto-merge.yaml
vendored
4
.github/workflows/dependabot-auto-merge.yaml
vendored
@@ -16,7 +16,9 @@ jobs:
|
|||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Enable auto-merge for Dependabot PRs
|
- name: Enable auto-merge for Dependabot PRs
|
||||||
if: steps.metadata.outputs.dependency-type == 'direct:development' && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch')
|
if: steps.metadata.outputs.dependency-type == 'direct:development' && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch')
|
||||||
run: gh pr merge --auto --squash "$PR_URL"
|
run: |
|
||||||
|
gh pr review --approve "$PR_URL"
|
||||||
|
gh pr merge --auto --squash "$PR_URL"
|
||||||
env:
|
env:
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
PR_URL: ${{ github.event.pull_request.html_url }}
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|||||||
30
.github/workflows/pull_request.yml
vendored
30
.github/workflows/pull_request.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DOCKER_BUILDKIT: "1"
|
DOCKER_BUILDKIT: "1"
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@master
|
- uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
@@ -34,7 +34,7 @@ jobs:
|
|||||||
name: Web - Lint
|
name: Web - Lint
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@master
|
- uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
@@ -48,7 +48,7 @@ jobs:
|
|||||||
name: Web - Test
|
name: Web - Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@master
|
- uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
@@ -63,25 +63,31 @@ jobs:
|
|||||||
name: Python Checks
|
name: Python Checks
|
||||||
steps:
|
steps:
|
||||||
- name: Check out the repository
|
- name: Check out the repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
||||||
uses: actions/setup-python@v4.5.0
|
uses: actions/setup-python@v4.7.0
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
python-version: ${{ env.DEFAULT_PYTHON }}
|
||||||
- name: Install requirements
|
- name: Install requirements
|
||||||
run: |
|
run: |
|
||||||
pip install pip
|
python3 -m pip install -U pip
|
||||||
pip install -r requirements-dev.txt
|
python3 -m pip install -r docker/main/requirements-dev.txt
|
||||||
- name: Lint
|
- name: Check black
|
||||||
run: |
|
run: |
|
||||||
python3 -m black frigate --check
|
black --check --diff frigate migrations docker *.py
|
||||||
|
- name: Check isort
|
||||||
|
run: |
|
||||||
|
isort --check --diff frigate migrations docker *.py
|
||||||
|
- name: Check ruff
|
||||||
|
run: |
|
||||||
|
ruff check frigate migrations docker *.py
|
||||||
|
|
||||||
python_tests:
|
python_tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: Python Tests
|
name: Python Tests
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code
|
- name: Check out code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
- uses: actions/setup-node@master
|
- uses: actions/setup-node@master
|
||||||
with:
|
with:
|
||||||
node-version: 16.x
|
node-version: 16.x
|
||||||
@@ -91,9 +97,9 @@ jobs:
|
|||||||
run: npm run build
|
run: npm run build
|
||||||
working-directory: ./web
|
working-directory: ./web
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: docker/setup-qemu-action@v3
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v2
|
uses: docker/setup-buildx-action@v3
|
||||||
- name: Build
|
- name: Build
|
||||||
run: make
|
run: make
|
||||||
- name: Run mypy
|
- name: Run mypy
|
||||||
|
|||||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -4,7 +4,8 @@
|
|||||||
debug
|
debug
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
config/config.yml
|
config/*
|
||||||
|
!config/*.example
|
||||||
models
|
models
|
||||||
*.mp4
|
*.mp4
|
||||||
*.ts
|
*.ts
|
||||||
|
|||||||
4
CODEOWNERS
Normal file
4
CODEOWNERS
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Community-supported boards
|
||||||
|
/docker/tensorrt/ @madsciencetist @NateMeyer
|
||||||
|
/docker/tensorrt/*arm64* @madsciencetist
|
||||||
|
/docker/tensorrt/*jetson* @madsciencetist
|
||||||
34
Makefile
34
Makefile
@@ -1,39 +1,39 @@
|
|||||||
default_target: local
|
default_target: local
|
||||||
|
|
||||||
COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1)
|
COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1)
|
||||||
VERSION = 0.12.0
|
VERSION = 0.13.0
|
||||||
IMAGE_REPO ?= ghcr.io/blakeblackshear/frigate
|
IMAGE_REPO ?= ghcr.io/blakeblackshear/frigate
|
||||||
|
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
||||||
CURRENT_UID := $(shell id -u)
|
CURRENT_UID := $(shell id -u)
|
||||||
CURRENT_GID := $(shell id -g)
|
CURRENT_GID := $(shell id -g)
|
||||||
|
BOARDS= #Initialized empty
|
||||||
|
|
||||||
|
include docker/*/*.mk
|
||||||
|
|
||||||
|
build-boards: $(BOARDS:%=build-%)
|
||||||
|
|
||||||
|
push-boards: $(BOARDS:%=push-%)
|
||||||
|
|
||||||
version:
|
version:
|
||||||
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
|
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
|
||||||
|
|
||||||
local: version
|
local: version
|
||||||
docker buildx build --target=frigate --tag frigate:latest --load .
|
docker buildx build --target=frigate --tag frigate:latest --load --file docker/main/Dockerfile .
|
||||||
|
|
||||||
local-trt: version
|
|
||||||
docker buildx build --target=frigate-tensorrt --tag frigate:latest-tensorrt --load .
|
|
||||||
|
|
||||||
amd64:
|
amd64:
|
||||||
docker buildx build --platform linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
|
docker buildx build --platform linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
docker buildx build --platform linux/amd64 --target=frigate-tensorrt --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH)-tensorrt .
|
|
||||||
|
|
||||||
arm64:
|
arm64:
|
||||||
docker buildx build --platform linux/arm64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
|
docker buildx build --platform linux/arm64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
|
|
||||||
armv7:
|
build: version amd64 arm64
|
||||||
docker buildx build --platform linux/arm/v7 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
|
docker buildx build --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
|
|
||||||
build: version amd64 arm64 armv7
|
push: push-boards
|
||||||
docker buildx build --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) .
|
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
||||||
|
|
||||||
push: build
|
|
||||||
docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) .
|
|
||||||
docker buildx build --push --platform linux/amd64 --target=frigate-tensorrt --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt .
|
|
||||||
|
|
||||||
run: local
|
run: local
|
||||||
docker run --rm --publish=5000:5000 --volume=${PWD}/config/config.yml:/config/config.yml frigate:latest
|
docker run --rm --publish=5000:5000 --volume=${PWD}/config:/config frigate:latest
|
||||||
|
|
||||||
run_tests: local
|
run_tests: local
|
||||||
docker run --rm --workdir=/opt/frigate --entrypoint= frigate:latest python3 -u -m unittest
|
docker run --rm --workdir=/opt/frigate --entrypoint= frigate:latest python3 -u -m unittest
|
||||||
|
|||||||
521
audio-labelmap.txt
Normal file
521
audio-labelmap.txt
Normal file
@@ -0,0 +1,521 @@
|
|||||||
|
speech
|
||||||
|
speech
|
||||||
|
speech
|
||||||
|
speech
|
||||||
|
babbling
|
||||||
|
speech
|
||||||
|
yell
|
||||||
|
bellow
|
||||||
|
whoop
|
||||||
|
yell
|
||||||
|
yell
|
||||||
|
yell
|
||||||
|
whispering
|
||||||
|
laughter
|
||||||
|
laughter
|
||||||
|
laughter
|
||||||
|
snicker
|
||||||
|
laughter
|
||||||
|
laughter
|
||||||
|
crying
|
||||||
|
crying
|
||||||
|
crying
|
||||||
|
yell
|
||||||
|
sigh
|
||||||
|
singing
|
||||||
|
choir
|
||||||
|
sodeling
|
||||||
|
chant
|
||||||
|
mantra
|
||||||
|
child_singing
|
||||||
|
synthetic_singing
|
||||||
|
rapping
|
||||||
|
humming
|
||||||
|
groan
|
||||||
|
grunt
|
||||||
|
whistling
|
||||||
|
breathing
|
||||||
|
wheeze
|
||||||
|
snoring
|
||||||
|
gasp
|
||||||
|
pant
|
||||||
|
snort
|
||||||
|
cough
|
||||||
|
throat_clearing
|
||||||
|
sneeze
|
||||||
|
sniff
|
||||||
|
run
|
||||||
|
shuffle
|
||||||
|
footsteps
|
||||||
|
chewing
|
||||||
|
biting
|
||||||
|
gargling
|
||||||
|
stomach_rumble
|
||||||
|
burping
|
||||||
|
hiccup
|
||||||
|
fart
|
||||||
|
hands
|
||||||
|
finger_snapping
|
||||||
|
clapping
|
||||||
|
heartbeat
|
||||||
|
heart_murmur
|
||||||
|
cheering
|
||||||
|
applause
|
||||||
|
chatter
|
||||||
|
crowd
|
||||||
|
speech
|
||||||
|
children_playing
|
||||||
|
animal
|
||||||
|
pets
|
||||||
|
dog
|
||||||
|
bark
|
||||||
|
yip
|
||||||
|
howl
|
||||||
|
bow-wow
|
||||||
|
growling
|
||||||
|
whimper_dog
|
||||||
|
cat
|
||||||
|
purr
|
||||||
|
meow
|
||||||
|
hiss
|
||||||
|
caterwaul
|
||||||
|
livestock
|
||||||
|
horse
|
||||||
|
clip-clop
|
||||||
|
neigh
|
||||||
|
cattle
|
||||||
|
moo
|
||||||
|
cowbell
|
||||||
|
pig
|
||||||
|
oink
|
||||||
|
goat
|
||||||
|
bleat
|
||||||
|
sheep
|
||||||
|
fowl
|
||||||
|
chicken
|
||||||
|
cluck
|
||||||
|
cock-a-doodle-doo
|
||||||
|
turkey
|
||||||
|
gobble
|
||||||
|
duck
|
||||||
|
quack
|
||||||
|
goose
|
||||||
|
honk
|
||||||
|
wild_animals
|
||||||
|
roaring_cats
|
||||||
|
roar
|
||||||
|
bird
|
||||||
|
chird
|
||||||
|
chirp
|
||||||
|
squawk
|
||||||
|
pigeon
|
||||||
|
coo
|
||||||
|
crow
|
||||||
|
caw
|
||||||
|
owl
|
||||||
|
hoot
|
||||||
|
flapping_wings
|
||||||
|
dogs
|
||||||
|
rats
|
||||||
|
mouse
|
||||||
|
patter
|
||||||
|
insect
|
||||||
|
cricket
|
||||||
|
mosquito
|
||||||
|
fly
|
||||||
|
buzz
|
||||||
|
buzz
|
||||||
|
frog
|
||||||
|
croak
|
||||||
|
snake
|
||||||
|
rattle
|
||||||
|
whale_vocalization
|
||||||
|
music
|
||||||
|
musical_instrument
|
||||||
|
plucked_string_instrument
|
||||||
|
guitar
|
||||||
|
electric_guitar
|
||||||
|
bass_guitar
|
||||||
|
acoustic_guitar
|
||||||
|
steel_guitar
|
||||||
|
tapping
|
||||||
|
strum
|
||||||
|
banjo
|
||||||
|
sitar
|
||||||
|
mandolin
|
||||||
|
zither
|
||||||
|
ukulele
|
||||||
|
keyboard
|
||||||
|
piano
|
||||||
|
electric_piano
|
||||||
|
organ
|
||||||
|
electronic_organ
|
||||||
|
hammond_organ
|
||||||
|
synthesizer
|
||||||
|
sampler
|
||||||
|
harpsichord
|
||||||
|
percussion
|
||||||
|
drum_kit
|
||||||
|
drum_machine
|
||||||
|
drum
|
||||||
|
snare_drum
|
||||||
|
rimshot
|
||||||
|
drum_roll
|
||||||
|
bass_drum
|
||||||
|
timpani
|
||||||
|
tabla
|
||||||
|
cymbal
|
||||||
|
hi-hat
|
||||||
|
wood_block
|
||||||
|
tambourine
|
||||||
|
rattle
|
||||||
|
maraca
|
||||||
|
gong
|
||||||
|
tubular_bells
|
||||||
|
mallet_percussion
|
||||||
|
marimba
|
||||||
|
glockenspiel
|
||||||
|
vibraphone
|
||||||
|
steelpan
|
||||||
|
orchestra
|
||||||
|
brass_instrument
|
||||||
|
french_horn
|
||||||
|
trumpet
|
||||||
|
trombone
|
||||||
|
bowed_string_instrument
|
||||||
|
string_section
|
||||||
|
violin
|
||||||
|
pizzicato
|
||||||
|
cello
|
||||||
|
double_bass
|
||||||
|
wind_instrument
|
||||||
|
flute
|
||||||
|
saxophone
|
||||||
|
clarinet
|
||||||
|
harp
|
||||||
|
bell
|
||||||
|
church_bell
|
||||||
|
jingle_bell
|
||||||
|
bicycle_bell
|
||||||
|
tuning_fork
|
||||||
|
chime
|
||||||
|
wind_chime
|
||||||
|
change_ringing
|
||||||
|
harmonica
|
||||||
|
accordion
|
||||||
|
bagpipes
|
||||||
|
didgeridoo
|
||||||
|
shofar
|
||||||
|
theremin
|
||||||
|
singing_bowl
|
||||||
|
scratching
|
||||||
|
pop_music
|
||||||
|
hip_hop_music
|
||||||
|
beatboxing
|
||||||
|
rock_music
|
||||||
|
heavy_metal
|
||||||
|
punk_rock
|
||||||
|
grunge
|
||||||
|
progressive_rock
|
||||||
|
rock_and_roll
|
||||||
|
psychedelic_rock
|
||||||
|
rhythm_and_blues
|
||||||
|
soul_music
|
||||||
|
reggae
|
||||||
|
country
|
||||||
|
swing_music
|
||||||
|
bluegrass
|
||||||
|
funk
|
||||||
|
folk_music
|
||||||
|
middle_eastern_music
|
||||||
|
jazz
|
||||||
|
disco
|
||||||
|
classical_music
|
||||||
|
opera
|
||||||
|
electronic_music
|
||||||
|
house_music
|
||||||
|
techno
|
||||||
|
dubstep
|
||||||
|
drum_and_bass
|
||||||
|
electronica
|
||||||
|
electronic_dance_music
|
||||||
|
ambient_music
|
||||||
|
trance_music
|
||||||
|
music_of_latin_america
|
||||||
|
salsa_music
|
||||||
|
flamenco
|
||||||
|
blues
|
||||||
|
music_for_children
|
||||||
|
new-age_music
|
||||||
|
vocal_music
|
||||||
|
a_capella
|
||||||
|
music_of_africa
|
||||||
|
afrobeat
|
||||||
|
christian_music
|
||||||
|
gospel_music
|
||||||
|
music_of_asia
|
||||||
|
carnatic_music
|
||||||
|
music_of_bollywood
|
||||||
|
ska
|
||||||
|
traditional_music
|
||||||
|
independent_music
|
||||||
|
song
|
||||||
|
background_music
|
||||||
|
theme_music
|
||||||
|
jingle
|
||||||
|
soundtrack_music
|
||||||
|
lullaby
|
||||||
|
video_game_music
|
||||||
|
christmas_music
|
||||||
|
dance_music
|
||||||
|
wedding_music
|
||||||
|
happy_music
|
||||||
|
sad_music
|
||||||
|
tender_music
|
||||||
|
exciting_music
|
||||||
|
angry_music
|
||||||
|
scary_music
|
||||||
|
wind
|
||||||
|
rustling_leaves
|
||||||
|
wind_noise
|
||||||
|
thunderstorm
|
||||||
|
thunder
|
||||||
|
water
|
||||||
|
rain
|
||||||
|
raindrop
|
||||||
|
rain_on_surface
|
||||||
|
stream
|
||||||
|
waterfall
|
||||||
|
ocean
|
||||||
|
waves
|
||||||
|
steam
|
||||||
|
gurgling
|
||||||
|
fire
|
||||||
|
crackle
|
||||||
|
vehicle
|
||||||
|
boat
|
||||||
|
sailboat
|
||||||
|
rowboat
|
||||||
|
motorboat
|
||||||
|
ship
|
||||||
|
motor_vehicle
|
||||||
|
car
|
||||||
|
honk
|
||||||
|
toot
|
||||||
|
car_alarm
|
||||||
|
power_windows
|
||||||
|
skidding
|
||||||
|
tire_squeal
|
||||||
|
car_passing_by
|
||||||
|
race_car
|
||||||
|
truck
|
||||||
|
air_brake
|
||||||
|
air_horn
|
||||||
|
reversing_beeps
|
||||||
|
ice_cream_truck
|
||||||
|
bus
|
||||||
|
emergency_vehicle
|
||||||
|
police_car
|
||||||
|
ambulance
|
||||||
|
fire_engine
|
||||||
|
motorcycle
|
||||||
|
traffic_noise
|
||||||
|
rail_transport
|
||||||
|
train
|
||||||
|
train_whistle
|
||||||
|
train_horn
|
||||||
|
railroad_car
|
||||||
|
train_wheels_squealing
|
||||||
|
subway
|
||||||
|
aircraft
|
||||||
|
aircraft_engine
|
||||||
|
jet_engine
|
||||||
|
propeller
|
||||||
|
helicopter
|
||||||
|
fixed-wing_aircraft
|
||||||
|
bicycle
|
||||||
|
skateboard
|
||||||
|
engine
|
||||||
|
light_engine
|
||||||
|
dental_drill's_drill
|
||||||
|
lawn_mower
|
||||||
|
chainsaw
|
||||||
|
medium_engine
|
||||||
|
heavy_engine
|
||||||
|
engine_knocking
|
||||||
|
engine_starting
|
||||||
|
idling
|
||||||
|
accelerating
|
||||||
|
door
|
||||||
|
doorbell
|
||||||
|
ding-dong
|
||||||
|
sliding_door
|
||||||
|
slam
|
||||||
|
knock
|
||||||
|
tap
|
||||||
|
squeak
|
||||||
|
cupboard_open_or_close
|
||||||
|
drawer_open_or_close
|
||||||
|
dishes
|
||||||
|
cutlery
|
||||||
|
chopping
|
||||||
|
frying
|
||||||
|
microwave_oven
|
||||||
|
blender
|
||||||
|
water_tap
|
||||||
|
sink
|
||||||
|
bathtub
|
||||||
|
hair_dryer
|
||||||
|
toilet_flush
|
||||||
|
toothbrush
|
||||||
|
electric_toothbrush
|
||||||
|
vacuum_cleaner
|
||||||
|
zipper
|
||||||
|
keys_jangling
|
||||||
|
coin
|
||||||
|
scissors
|
||||||
|
electric_shaver
|
||||||
|
shuffling_cards
|
||||||
|
typing
|
||||||
|
typewriter
|
||||||
|
computer_keyboard
|
||||||
|
writing
|
||||||
|
alarm
|
||||||
|
telephone
|
||||||
|
telephone_bell_ringing
|
||||||
|
ringtone
|
||||||
|
telephone_dialing
|
||||||
|
dial_tone
|
||||||
|
busy_signal
|
||||||
|
alarm_clock
|
||||||
|
siren
|
||||||
|
civil_defense_siren
|
||||||
|
buzzer
|
||||||
|
smoke_detector
|
||||||
|
fire_alarm
|
||||||
|
foghorn
|
||||||
|
whistle
|
||||||
|
steam_whistle
|
||||||
|
mechanisms
|
||||||
|
ratchet
|
||||||
|
clock
|
||||||
|
tick
|
||||||
|
tick-tock
|
||||||
|
gears
|
||||||
|
pulleys
|
||||||
|
sewing_machine
|
||||||
|
mechanical_fan
|
||||||
|
air_conditioning
|
||||||
|
cash_register
|
||||||
|
printer
|
||||||
|
camera
|
||||||
|
single-lens_reflex_camera
|
||||||
|
tools
|
||||||
|
hammer
|
||||||
|
jackhammer
|
||||||
|
sawing
|
||||||
|
filing
|
||||||
|
sanding
|
||||||
|
power_tool
|
||||||
|
drill
|
||||||
|
explosion
|
||||||
|
gunshot
|
||||||
|
machine_gun
|
||||||
|
fusillade
|
||||||
|
artillery_fire
|
||||||
|
cap_gun
|
||||||
|
fireworks
|
||||||
|
firecracker
|
||||||
|
burst
|
||||||
|
eruption
|
||||||
|
boom
|
||||||
|
wood
|
||||||
|
chop
|
||||||
|
splinter
|
||||||
|
crack
|
||||||
|
glass
|
||||||
|
chink
|
||||||
|
shatter
|
||||||
|
liquid
|
||||||
|
splash
|
||||||
|
slosh
|
||||||
|
squish
|
||||||
|
drip
|
||||||
|
pour
|
||||||
|
trickle
|
||||||
|
gush
|
||||||
|
fill
|
||||||
|
spray
|
||||||
|
pump
|
||||||
|
stir
|
||||||
|
boiling
|
||||||
|
sonar
|
||||||
|
arrow
|
||||||
|
whoosh
|
||||||
|
thump
|
||||||
|
thunk
|
||||||
|
electronic_tuner
|
||||||
|
effects_unit
|
||||||
|
chorus_effect
|
||||||
|
basketball_bounce
|
||||||
|
bang
|
||||||
|
slap
|
||||||
|
whack
|
||||||
|
smash
|
||||||
|
breaking
|
||||||
|
bouncing
|
||||||
|
whip
|
||||||
|
flap
|
||||||
|
scratch
|
||||||
|
scrape
|
||||||
|
rub
|
||||||
|
roll
|
||||||
|
crushing
|
||||||
|
crumpling
|
||||||
|
tearing
|
||||||
|
beep
|
||||||
|
ping
|
||||||
|
ding
|
||||||
|
clang
|
||||||
|
squeal
|
||||||
|
creak
|
||||||
|
rustle
|
||||||
|
whir
|
||||||
|
clatter
|
||||||
|
sizzle
|
||||||
|
clicking
|
||||||
|
clickety-clack
|
||||||
|
rumble
|
||||||
|
plop
|
||||||
|
jingle
|
||||||
|
hum
|
||||||
|
zing
|
||||||
|
boing
|
||||||
|
crunch
|
||||||
|
silence
|
||||||
|
sine_wave
|
||||||
|
harmonic
|
||||||
|
chirp_tone
|
||||||
|
sound_effect
|
||||||
|
pulse
|
||||||
|
inside
|
||||||
|
inside
|
||||||
|
inside
|
||||||
|
outside
|
||||||
|
outside
|
||||||
|
reverberation
|
||||||
|
echo
|
||||||
|
noise
|
||||||
|
environmental_noise
|
||||||
|
static
|
||||||
|
mains_hum
|
||||||
|
distortion
|
||||||
|
sidetone
|
||||||
|
cacophony
|
||||||
|
white_noise
|
||||||
|
pink_noise
|
||||||
|
throbbing
|
||||||
|
vibration
|
||||||
|
television
|
||||||
|
radio
|
||||||
|
field_recording
|
||||||
12
benchmark.py
12
benchmark.py
@@ -1,11 +1,11 @@
|
|||||||
import os
|
|
||||||
from statistics import mean
|
|
||||||
import multiprocessing as mp
|
|
||||||
import numpy as np
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import multiprocessing as mp
|
||||||
|
from statistics import mean
|
||||||
|
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
from frigate.config import DetectorTypeEnum
|
from frigate.config import DetectorTypeEnum
|
||||||
from frigate.object_detection import (
|
from frigate.object_detection import (
|
||||||
LocalObjectDetector,
|
|
||||||
ObjectDetectProcess,
|
ObjectDetectProcess,
|
||||||
RemoteObjectDetector,
|
RemoteObjectDetector,
|
||||||
load_labels,
|
load_labels,
|
||||||
@@ -53,7 +53,7 @@ def start(id, num_detections, detection_queue, event):
|
|||||||
frame_times = []
|
frame_times = []
|
||||||
for x in range(0, num_detections):
|
for x in range(0, num_detections):
|
||||||
start_frame = datetime.datetime.now().timestamp()
|
start_frame = datetime.datetime.now().timestamp()
|
||||||
detections = object_detector.detect(my_frame)
|
object_detector.detect(my_frame)
|
||||||
frame_times.append(datetime.datetime.now().timestamp() - start_frame)
|
frame_times.append(datetime.datetime.now().timestamp() - start_frame)
|
||||||
|
|
||||||
duration = datetime.datetime.now().timestamp() - start
|
duration = datetime.datetime.now().timestamp() - start
|
||||||
|
|||||||
118
benchmark_motion.py
Normal file
118
benchmark_motion.py
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
import datetime
|
||||||
|
import multiprocessing as mp
|
||||||
|
import os
|
||||||
|
|
||||||
|
import cv2
|
||||||
|
import numpy as np
|
||||||
|
|
||||||
|
from frigate.config import MotionConfig
|
||||||
|
from frigate.motion.improved_motion import ImprovedMotionDetector
|
||||||
|
from frigate.util import create_mask
|
||||||
|
|
||||||
|
# get info on the video
|
||||||
|
# cap = cv2.VideoCapture("debug/front_cam_2023_05_23_08_41__2023_05_23_08_43.mp4")
|
||||||
|
# cap = cv2.VideoCapture("debug/motion_test_clips/rain_1.mp4")
|
||||||
|
cap = cv2.VideoCapture("debug/motion_test_clips/lawn_mower_night_1.mp4")
|
||||||
|
# cap = cv2.VideoCapture("airport.mp4")
|
||||||
|
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
|
||||||
|
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
|
||||||
|
fps = cap.get(cv2.CAP_PROP_FPS)
|
||||||
|
frame_shape = (height, width, 3)
|
||||||
|
# Nick back:
|
||||||
|
# "1280,0,1280,316,1170,216,1146,126,1016,127,979,82,839,0",
|
||||||
|
# "310,350,300,402,224,405,241,354",
|
||||||
|
# "378,0,375,26,0,23,0,0",
|
||||||
|
# Front door:
|
||||||
|
# "1080,0,1080,339,1010,280,1020,169,777,163,452,170,318,299,191,365,186,417,139,470,108,516,40,530,0,514,0,0",
|
||||||
|
# "336,833,438,1024,346,1093,103,1052,24,814",
|
||||||
|
# Back
|
||||||
|
# "1855,0,1851,100,1289,96,1105,161,1045,119,890,121,890,0",
|
||||||
|
# "505,95,506,138,388,153,384,114",
|
||||||
|
# "689,72,689,122,549,134,547,89",
|
||||||
|
# "261,134,264,176,169,195,167,158",
|
||||||
|
# "145,159,146,202,70,220,65,183",
|
||||||
|
|
||||||
|
mask = create_mask(
|
||||||
|
(height, width),
|
||||||
|
[
|
||||||
|
"1080,0,1080,339,1010,280,1020,169,777,163,452,170,318,299,191,365,186,417,139,470,108,516,40,530,0,514,0,0",
|
||||||
|
"336,833,438,1024,346,1093,103,1052,24,814",
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
# create the motion config
|
||||||
|
motion_config_1 = MotionConfig()
|
||||||
|
motion_config_1.mask = np.zeros((height, width), np.uint8)
|
||||||
|
motion_config_1.mask[:] = mask
|
||||||
|
# motion_config_1.improve_contrast = 1
|
||||||
|
motion_config_1.frame_height = 150
|
||||||
|
# motion_config_1.frame_alpha = 0.02
|
||||||
|
# motion_config_1.threshold = 30
|
||||||
|
# motion_config_1.contour_area = 10
|
||||||
|
|
||||||
|
motion_config_2 = MotionConfig()
|
||||||
|
motion_config_2.mask = np.zeros((height, width), np.uint8)
|
||||||
|
motion_config_2.mask[:] = mask
|
||||||
|
# motion_config_2.improve_contrast = 1
|
||||||
|
motion_config_2.frame_height = 150
|
||||||
|
# motion_config_2.frame_alpha = 0.01
|
||||||
|
motion_config_2.threshold = 20
|
||||||
|
# motion_config.contour_area = 10
|
||||||
|
|
||||||
|
save_images = True
|
||||||
|
|
||||||
|
improved_motion_detector_1 = ImprovedMotionDetector(
|
||||||
|
frame_shape=frame_shape,
|
||||||
|
config=motion_config_1,
|
||||||
|
fps=fps,
|
||||||
|
improve_contrast=mp.Value("i", motion_config_1.improve_contrast),
|
||||||
|
threshold=mp.Value("i", motion_config_1.threshold),
|
||||||
|
contour_area=mp.Value("i", motion_config_1.contour_area),
|
||||||
|
name="default",
|
||||||
|
)
|
||||||
|
improved_motion_detector_1.save_images = save_images
|
||||||
|
|
||||||
|
improved_motion_detector_2 = ImprovedMotionDetector(
|
||||||
|
frame_shape=frame_shape,
|
||||||
|
config=motion_config_2,
|
||||||
|
fps=fps,
|
||||||
|
improve_contrast=mp.Value("i", motion_config_2.improve_contrast),
|
||||||
|
threshold=mp.Value("i", motion_config_2.threshold),
|
||||||
|
contour_area=mp.Value("i", motion_config_2.contour_area),
|
||||||
|
name="compare",
|
||||||
|
)
|
||||||
|
improved_motion_detector_2.save_images = save_images
|
||||||
|
|
||||||
|
# read and process frames
|
||||||
|
ret, frame = cap.read()
|
||||||
|
frame_counter = 1
|
||||||
|
while ret:
|
||||||
|
yuv_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2YUV_I420)
|
||||||
|
|
||||||
|
start_frame = datetime.datetime.now().timestamp()
|
||||||
|
improved_motion_detector_1.detect(yuv_frame)
|
||||||
|
|
||||||
|
start_frame = datetime.datetime.now().timestamp()
|
||||||
|
improved_motion_detector_2.detect(yuv_frame)
|
||||||
|
|
||||||
|
default_frame = f"debug/frames/default-{frame_counter}.jpg"
|
||||||
|
compare_frame = f"debug/frames/compare-{frame_counter}.jpg"
|
||||||
|
if os.path.exists(default_frame) and os.path.exists(compare_frame):
|
||||||
|
images = [
|
||||||
|
cv2.imread(default_frame),
|
||||||
|
cv2.imread(compare_frame),
|
||||||
|
]
|
||||||
|
|
||||||
|
cv2.imwrite(
|
||||||
|
f"debug/frames/all-{frame_counter}.jpg",
|
||||||
|
cv2.vconcat(images)
|
||||||
|
if frame_shape[0] > frame_shape[1]
|
||||||
|
else cv2.hconcat(images),
|
||||||
|
)
|
||||||
|
os.unlink(default_frame)
|
||||||
|
os.unlink(compare_frame)
|
||||||
|
frame_counter += 1
|
||||||
|
|
||||||
|
ret, frame = cap.read()
|
||||||
|
|
||||||
|
cap.release()
|
||||||
@@ -11,6 +11,7 @@ services:
|
|||||||
shm_size: "256mb"
|
shm_size: "256mb"
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
|
dockerfile: docker/main/Dockerfile
|
||||||
# Use target devcontainer-trt for TensorRT dev
|
# Use target devcontainer-trt for TensorRT dev
|
||||||
target: devcontainer
|
target: devcontainer
|
||||||
deploy:
|
deploy:
|
||||||
@@ -20,6 +21,8 @@ services:
|
|||||||
- driver: nvidia
|
- driver: nvidia
|
||||||
count: 1
|
count: 1
|
||||||
capabilities: [gpu]
|
capabilities: [gpu]
|
||||||
|
environment:
|
||||||
|
YOLO_MODELS: yolov7-320
|
||||||
devices:
|
devices:
|
||||||
- /dev/bus/usb:/dev/bus/usb
|
- /dev/bus/usb:/dev/bus/usb
|
||||||
# - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware
|
# - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware
|
||||||
@@ -27,10 +30,8 @@ services:
|
|||||||
- .:/workspace/frigate:cached
|
- .:/workspace/frigate:cached
|
||||||
- ./web/dist:/opt/frigate/web:cached
|
- ./web/dist:/opt/frigate/web:cached
|
||||||
- /etc/localtime:/etc/localtime:ro
|
- /etc/localtime:/etc/localtime:ro
|
||||||
- ./config/config.yml:/config/config.yml:ro
|
- ./config:/config
|
||||||
- ./debug:/media/frigate
|
- ./debug:/media/frigate
|
||||||
# Create the trt-models folder using the documented method of generating TRT models
|
|
||||||
# - ./debug/trt-models:/trt-models
|
|
||||||
- /dev/bus/usb:/dev/bus/usb
|
- /dev/bus/usb:/dev/bus/usb
|
||||||
mqtt:
|
mqtt:
|
||||||
container_name: mqtt
|
container_name: mqtt
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
# syntax=docker/dockerfile:1.2
|
# syntax=docker/dockerfile:1.6
|
||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
FROM debian:11 AS base
|
ARG BASE_IMAGE=debian:11
|
||||||
|
ARG SLIM_BASE=debian:11-slim
|
||||||
|
|
||||||
FROM --platform=linux/amd64 debian:11 AS base_amd64
|
FROM ${BASE_IMAGE} AS base
|
||||||
|
|
||||||
FROM debian:11-slim AS slim-base
|
FROM --platform=${BUILDPLATFORM} debian:11 AS base_host
|
||||||
|
|
||||||
|
FROM ${SLIM_BASE} AS slim-base
|
||||||
|
|
||||||
FROM slim-base AS wget
|
FROM slim-base AS wget
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
@@ -18,17 +21,19 @@ WORKDIR /rootfs
|
|||||||
|
|
||||||
FROM base AS nginx
|
FROM base AS nginx
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
|
ENV CCACHE_DIR /root/.ccache
|
||||||
|
ENV CCACHE_MAXSIZE 2G
|
||||||
|
|
||||||
# bind /var/cache/apt to tmpfs to speed up nginx build
|
# bind /var/cache/apt to tmpfs to speed up nginx build
|
||||||
RUN --mount=type=tmpfs,target=/tmp --mount=type=tmpfs,target=/var/cache/apt \
|
RUN --mount=type=tmpfs,target=/tmp --mount=type=tmpfs,target=/var/cache/apt \
|
||||||
--mount=type=bind,source=docker/build_nginx.sh,target=/deps/build_nginx.sh \
|
--mount=type=bind,source=docker/main/build_nginx.sh,target=/deps/build_nginx.sh \
|
||||||
|
--mount=type=cache,target=/root/.ccache \
|
||||||
/deps/build_nginx.sh
|
/deps/build_nginx.sh
|
||||||
|
|
||||||
FROM wget AS go2rtc
|
FROM scratch AS go2rtc
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
WORKDIR /rootfs/usr/local/go2rtc/bin
|
WORKDIR /rootfs/usr/local/go2rtc/bin
|
||||||
RUN wget -qO go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v1.2.0/go2rtc_linux_${TARGETARCH}" \
|
ADD --link --chmod=755 "https://github.com/AlexxIT/go2rtc/releases/download/v1.7.1/go2rtc_linux_${TARGETARCH}" go2rtc
|
||||||
&& chmod +x go2rtc
|
|
||||||
|
|
||||||
|
|
||||||
####
|
####
|
||||||
@@ -40,11 +45,11 @@ RUN wget -qO go2rtc "https://github.com/AlexxIT/go2rtc/releases/download/v1.2.0/
|
|||||||
#
|
#
|
||||||
####
|
####
|
||||||
# Download and Convert OpenVino model
|
# Download and Convert OpenVino model
|
||||||
FROM base_amd64 AS ov-converter
|
FROM base_host AS ov-converter
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
|
|
||||||
# Install OpenVino Runtime and Dev library
|
# Install OpenVino Runtime and Dev library
|
||||||
COPY requirements-ov.txt /requirements-ov.txt
|
COPY docker/main/requirements-ov.txt /requirements-ov.txt
|
||||||
RUN apt-get -qq update \
|
RUN apt-get -qq update \
|
||||||
&& apt-get -qq install -y wget python3 python3-distutils \
|
&& apt-get -qq install -y wget python3 python3-distutils \
|
||||||
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
@@ -61,25 +66,27 @@ RUN mkdir /models \
|
|||||||
FROM wget as libusb-build
|
FROM wget as libusb-build
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
ARG DEBIAN_FRONTEND
|
ARG DEBIAN_FRONTEND
|
||||||
|
ENV CCACHE_DIR /root/.ccache
|
||||||
|
ENV CCACHE_MAXSIZE 2G
|
||||||
|
|
||||||
# Build libUSB without udev. Needed for Openvino NCS2 support
|
# Build libUSB without udev. Needed for Openvino NCS2 support
|
||||||
WORKDIR /opt
|
WORKDIR /opt
|
||||||
RUN apt-get update && apt-get install -y unzip build-essential automake libtool
|
RUN apt-get update && apt-get install -y unzip build-essential automake libtool ccache pkg-config
|
||||||
RUN wget -q https://github.com/libusb/libusb/archive/v1.0.25.zip -O v1.0.25.zip && \
|
RUN --mount=type=cache,target=/root/.ccache wget -q https://github.com/libusb/libusb/archive/v1.0.26.zip -O v1.0.26.zip && \
|
||||||
unzip v1.0.25.zip && cd libusb-1.0.25 && \
|
unzip v1.0.26.zip && cd libusb-1.0.26 && \
|
||||||
./bootstrap.sh && \
|
./bootstrap.sh && \
|
||||||
./configure --disable-udev --enable-shared && \
|
./configure CC='ccache gcc' CCX='ccache g++' --disable-udev --enable-shared && \
|
||||||
make -j $(nproc --all)
|
make -j $(nproc --all)
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends libusb-1.0-0-dev && \
|
apt-get install -y --no-install-recommends libusb-1.0-0-dev && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
WORKDIR /opt/libusb-1.0.25/libusb
|
WORKDIR /opt/libusb-1.0.26/libusb
|
||||||
RUN /bin/mkdir -p '/usr/local/lib' && \
|
RUN /bin/mkdir -p '/usr/local/lib' && \
|
||||||
/bin/bash ../libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' && \
|
/bin/bash ../libtool --mode=install /usr/bin/install -c libusb-1.0.la '/usr/local/lib' && \
|
||||||
/bin/mkdir -p '/usr/local/include/libusb-1.0' && \
|
/bin/mkdir -p '/usr/local/include/libusb-1.0' && \
|
||||||
/usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' && \
|
/usr/bin/install -c -m 644 libusb.h '/usr/local/include/libusb-1.0' && \
|
||||||
/bin/mkdir -p '/usr/local/lib/pkgconfig' && \
|
/bin/mkdir -p '/usr/local/lib/pkgconfig' && \
|
||||||
cd /opt/libusb-1.0.25/ && \
|
cd /opt/libusb-1.0.26/ && \
|
||||||
/usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \
|
/usr/bin/install -c -m 644 libusb-1.0.pc '/usr/local/lib/pkgconfig' && \
|
||||||
ldconfig
|
ldconfig
|
||||||
|
|
||||||
@@ -93,12 +100,14 @@ COPY labelmap.txt .
|
|||||||
COPY --from=ov-converter /models/public/ssdlite_mobilenet_v2/FP16 openvino-model
|
COPY --from=ov-converter /models/public/ssdlite_mobilenet_v2/FP16 openvino-model
|
||||||
RUN wget -q https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt -O openvino-model/coco_91cl_bkgr.txt && \
|
RUN wget -q https://github.com/openvinotoolkit/open_model_zoo/raw/master/data/dataset_classes/coco_91cl_bkgr.txt -O openvino-model/coco_91cl_bkgr.txt && \
|
||||||
sed -i 's/truck/car/g' openvino-model/coco_91cl_bkgr.txt
|
sed -i 's/truck/car/g' openvino-model/coco_91cl_bkgr.txt
|
||||||
|
# Get Audio Model and labels
|
||||||
|
RUN wget -qO cpu_audio_model.tflite https://tfhub.dev/google/lite-model/yamnet/classification/tflite/1?lite-format=tflite
|
||||||
|
COPY audio-labelmap.txt .
|
||||||
|
|
||||||
|
|
||||||
FROM wget AS s6-overlay
|
FROM wget AS s6-overlay
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
RUN --mount=type=bind,source=docker/install_s6_overlay.sh,target=/deps/install_s6_overlay.sh \
|
RUN --mount=type=bind,source=docker/main/install_s6_overlay.sh,target=/deps/install_s6_overlay.sh \
|
||||||
/deps/install_s6_overlay.sh
|
/deps/install_s6_overlay.sh
|
||||||
|
|
||||||
|
|
||||||
@@ -112,13 +121,15 @@ RUN apt-get -qq update \
|
|||||||
apt-transport-https \
|
apt-transport-https \
|
||||||
gnupg \
|
gnupg \
|
||||||
wget \
|
wget \
|
||||||
&& apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 9165938D90FDDD2E \
|
# the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html
|
||||||
&& echo "deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi" | tee /etc/apt/sources.list.d/raspi.list \
|
&& wget -qO- "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xA4285295FC7B1A81600062A9605C66F00D6C9793" | \
|
||||||
|
gpg --dearmor > /usr/share/keyrings/debian-archive-bullseye-stable.gpg \
|
||||||
|
&& echo "deb [signed-by=/usr/share/keyrings/debian-archive-bullseye-stable.gpg] http://deb.debian.org/debian bullseye main contrib non-free" | \
|
||||||
|
tee /etc/apt/sources.list.d/debian-bullseye-nonfree.list \
|
||||||
&& apt-get -qq update \
|
&& apt-get -qq update \
|
||||||
&& apt-get -qq install -y \
|
&& apt-get -qq install -y \
|
||||||
python3 \
|
python3.9 \
|
||||||
python3-dev \
|
python3.9-dev \
|
||||||
wget \
|
|
||||||
# opencv dependencies
|
# opencv dependencies
|
||||||
build-essential cmake git pkg-config libgtk-3-dev \
|
build-essential cmake git pkg-config libgtk-3-dev \
|
||||||
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
|
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
|
||||||
@@ -130,28 +141,17 @@ RUN apt-get -qq update \
|
|||||||
gcc gfortran libopenblas-dev liblapack-dev && \
|
gcc gfortran libopenblas-dev liblapack-dev && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Ensure python3 defaults to python3.9
|
||||||
|
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
|
||||||
|
|
||||||
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
&& python3 get-pip.py "pip"
|
&& python3 get-pip.py "pip"
|
||||||
|
|
||||||
RUN if [ "${TARGETARCH}" = "arm" ]; \
|
COPY docker/main/requirements.txt /requirements.txt
|
||||||
then echo "[global]" > /etc/pip.conf \
|
RUN pip3 install -r /requirements.txt
|
||||||
&& echo "extra-index-url=https://www.piwheels.org/simple" >> /etc/pip.conf; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
COPY requirements.txt /requirements.txt
|
COPY docker/main/requirements-wheels.txt /requirements-wheels.txt
|
||||||
RUN pip3 install -r requirements.txt
|
RUN pip3 wheel --wheel-dir=/wheels -r /requirements-wheels.txt
|
||||||
|
|
||||||
COPY requirements-wheels.txt /requirements-wheels.txt
|
|
||||||
RUN pip3 wheel --wheel-dir=/wheels -r requirements-wheels.txt
|
|
||||||
|
|
||||||
# Make this a separate target so it can be built/cached optionally
|
|
||||||
FROM wheels as trt-wheels
|
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
# Add TensorRT wheels to another folder
|
|
||||||
COPY requirements-tensorrt.txt /requirements-tensorrt.txt
|
|
||||||
RUN mkdir -p /trt-wheels && pip3 wheel --wheel-dir=/trt-wheels -r requirements-tensorrt.txt
|
|
||||||
|
|
||||||
|
|
||||||
# Collect deps in a single layer
|
# Collect deps in a single layer
|
||||||
@@ -161,7 +161,7 @@ COPY --from=go2rtc /rootfs/ /
|
|||||||
COPY --from=libusb-build /usr/local/lib /usr/local/lib
|
COPY --from=libusb-build /usr/local/lib /usr/local/lib
|
||||||
COPY --from=s6-overlay /rootfs/ /
|
COPY --from=s6-overlay /rootfs/ /
|
||||||
COPY --from=models /rootfs/ /
|
COPY --from=models /rootfs/ /
|
||||||
COPY docker/rootfs/ /
|
COPY docker/main/rootfs/ /
|
||||||
|
|
||||||
|
|
||||||
# Frigate deps (ffmpeg, python, nginx, go2rtc, s6-overlay, etc)
|
# Frigate deps (ffmpeg, python, nginx, go2rtc, s6-overlay, etc)
|
||||||
@@ -179,10 +179,11 @@ ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
|
|||||||
ENV PATH="/usr/lib/btbn-ffmpeg/bin:/usr/local/go2rtc/bin:/usr/local/nginx/sbin:${PATH}"
|
ENV PATH="/usr/lib/btbn-ffmpeg/bin:/usr/local/go2rtc/bin:/usr/local/nginx/sbin:${PATH}"
|
||||||
|
|
||||||
# Install dependencies
|
# Install dependencies
|
||||||
RUN --mount=type=bind,source=docker/install_deps.sh,target=/deps/install_deps.sh \
|
RUN --mount=type=bind,source=docker/main/install_deps.sh,target=/deps/install_deps.sh \
|
||||||
/deps/install_deps.sh
|
/deps/install_deps.sh
|
||||||
|
|
||||||
RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \
|
RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \
|
||||||
|
python3 -m pip install --upgrade pip && \
|
||||||
pip3 install -U /deps/wheels/*.whl
|
pip3 install -U /deps/wheels/*.whl
|
||||||
|
|
||||||
COPY --from=deps-rootfs / /
|
COPY --from=deps-rootfs / /
|
||||||
@@ -200,12 +201,15 @@ ENV S6_LOGGING_SCRIPT="T 1 n0 s10000000 T"
|
|||||||
ENTRYPOINT ["/init"]
|
ENTRYPOINT ["/init"]
|
||||||
CMD []
|
CMD []
|
||||||
|
|
||||||
|
HEALTHCHECK --start-period=120s --start-interval=5s --interval=15s --timeout=5s --retries=3 \
|
||||||
|
CMD curl --fail --silent --show-error http://127.0.0.1:5000/api/version || exit 1
|
||||||
|
|
||||||
# Frigate deps with Node.js and NPM for devcontainer
|
# Frigate deps with Node.js and NPM for devcontainer
|
||||||
FROM deps AS devcontainer
|
FROM deps AS devcontainer
|
||||||
|
|
||||||
# Do not start the actual Frigate service on devcontainer as it will be started by VSCode
|
# Do not start the actual Frigate service on devcontainer as it will be started by VSCode
|
||||||
# But start a fake service for simulating the logs
|
# But start a fake service for simulating the logs
|
||||||
COPY docker/fake_frigate_run /etc/s6-overlay/s6-rc.d/frigate/run
|
COPY docker/main/fake_frigate_run /etc/s6-overlay/s6-rc.d/frigate/run
|
||||||
|
|
||||||
# Create symbolic link to the frigate source code, as go2rtc's create_config.sh uses it
|
# Create symbolic link to the frigate source code, as go2rtc's create_config.sh uses it
|
||||||
RUN mkdir -p /opt/frigate \
|
RUN mkdir -p /opt/frigate \
|
||||||
@@ -225,15 +229,15 @@ RUN apt-get update \
|
|||||||
&& apt-get install make -y \
|
&& apt-get install make -y \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
RUN --mount=type=bind,source=./requirements-dev.txt,target=/workspace/frigate/requirements-dev.txt \
|
RUN --mount=type=bind,source=./docker/main/requirements-dev.txt,target=/workspace/frigate/requirements-dev.txt \
|
||||||
pip3 install -r requirements-dev.txt
|
pip3 install -r requirements-dev.txt
|
||||||
|
|
||||||
CMD ["sleep", "infinity"]
|
CMD ["sleep", "infinity"]
|
||||||
|
|
||||||
|
|
||||||
# Frigate web build
|
# Frigate web build
|
||||||
# force this to run on amd64 because QEMU is painfully slow
|
# This should be architecture agnostic, so speed up the build on multiarch by not using QEMU.
|
||||||
FROM --platform=linux/amd64 node:16 AS web-build
|
FROM --platform=$BUILDPLATFORM node:16 AS web-build
|
||||||
|
|
||||||
WORKDIR /work
|
WORKDIR /work
|
||||||
COPY web/package.json web/package-lock.json ./
|
COPY web/package.json web/package-lock.json ./
|
||||||
@@ -257,16 +261,3 @@ FROM deps AS frigate
|
|||||||
|
|
||||||
WORKDIR /opt/frigate/
|
WORKDIR /opt/frigate/
|
||||||
COPY --from=rootfs / /
|
COPY --from=rootfs / /
|
||||||
|
|
||||||
# Frigate w/ TensorRT Support as separate image
|
|
||||||
FROM frigate AS frigate-tensorrt
|
|
||||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
|
||||||
pip3 install -U /deps/trt-wheels/*.whl && \
|
|
||||||
ln -s libnvrtc.so.11.2 /usr/local/lib/python3.9/dist-packages/nvidia/cuda_nvrtc/lib/libnvrtc.so && \
|
|
||||||
ldconfig
|
|
||||||
|
|
||||||
# Dev Container w/ TRT
|
|
||||||
FROM devcontainer AS devcontainer-trt
|
|
||||||
|
|
||||||
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
|
||||||
pip3 install -U /deps/trt-wheels/*.whl
|
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
NGINX_VERSION="1.22.1"
|
NGINX_VERSION="1.25.2"
|
||||||
VOD_MODULE_VERSION="1.30"
|
VOD_MODULE_VERSION="1.31"
|
||||||
SECURE_TOKEN_MODULE_VERSION="1.4"
|
SECURE_TOKEN_MODULE_VERSION="1.5"
|
||||||
RTMP_MODULE_VERSION="1.2.1"
|
RTMP_MODULE_VERSION="1.2.2"
|
||||||
|
|
||||||
cp /etc/apt/sources.list /etc/apt/sources.list.d/sources-src.list
|
cp /etc/apt/sources.list /etc/apt/sources.list.d/sources-src.list
|
||||||
sed -i 's|deb http|deb-src http|g' /etc/apt/sources.list.d/sources-src.list
|
sed -i 's|deb http|deb-src http|g' /etc/apt/sources.list.d/sources-src.list
|
||||||
@@ -15,6 +15,10 @@ apt-get -yqq build-dep nginx
|
|||||||
|
|
||||||
apt-get -yqq install --no-install-recommends ca-certificates wget
|
apt-get -yqq install --no-install-recommends ca-certificates wget
|
||||||
update-ca-certificates -f
|
update-ca-certificates -f
|
||||||
|
apt install -y ccache
|
||||||
|
|
||||||
|
export PATH="/usr/lib/ccache:$PATH"
|
||||||
|
|
||||||
mkdir /tmp/nginx
|
mkdir /tmp/nginx
|
||||||
wget -nv https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
|
wget -nv https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
|
||||||
tar -zxf nginx-${NGINX_VERSION}.tar.gz -C /tmp/nginx --strip-components=1
|
tar -zxf nginx-${NGINX_VERSION}.tar.gz -C /tmp/nginx --strip-components=1
|
||||||
@@ -62,5 +66,5 @@ cd /tmp/nginx
|
|||||||
--add-module=../nginx-rtmp-module \
|
--add-module=../nginx-rtmp-module \
|
||||||
--with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
|
--with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
|
||||||
|
|
||||||
make -j$(nproc) && make install
|
make CC="ccache gcc" -j$(nproc) && make install
|
||||||
rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
|
rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
|
||||||
@@ -10,19 +10,27 @@ apt-get -qq install --no-install-recommends -y \
|
|||||||
wget \
|
wget \
|
||||||
procps vainfo \
|
procps vainfo \
|
||||||
unzip locales tzdata libxml2 xz-utils \
|
unzip locales tzdata libxml2 xz-utils \
|
||||||
|
python3.9 \
|
||||||
python3-pip \
|
python3-pip \
|
||||||
curl \
|
curl \
|
||||||
jq
|
jq \
|
||||||
|
nethogs
|
||||||
|
|
||||||
|
# ensure python3 defaults to python3.9
|
||||||
|
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
|
||||||
|
|
||||||
mkdir -p -m 600 /root/.gnupg
|
mkdir -p -m 600 /root/.gnupg
|
||||||
|
|
||||||
# add coral repo
|
# add coral repo
|
||||||
wget --quiet -O /usr/share/keyrings/google-edgetpu.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg
|
curl -fsSLo - https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
|
||||||
echo "deb [signed-by=/usr/share/keyrings/google-edgetpu.gpg] https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list
|
gpg --dearmor -o /etc/apt/trusted.gpg.d/google-cloud-packages-archive-keyring.gpg
|
||||||
|
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" | tee /etc/apt/sources.list.d/coral-edgetpu.list
|
||||||
echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections
|
echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections
|
||||||
|
|
||||||
# enable non-free repo
|
# enable non-free repo in Debian
|
||||||
sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list
|
if grep -q "Debian" /etc/issue; then
|
||||||
|
sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list
|
||||||
|
fi
|
||||||
|
|
||||||
# coral drivers
|
# coral drivers
|
||||||
apt-get -qq update
|
apt-get -qq update
|
||||||
@@ -37,33 +45,30 @@ if [[ "${TARGETARCH}" == "amd64" ]]; then
|
|||||||
rm -rf btbn-ffmpeg.tar.xz /usr/lib/btbn-ffmpeg/doc /usr/lib/btbn-ffmpeg/bin/ffplay
|
rm -rf btbn-ffmpeg.tar.xz /usr/lib/btbn-ffmpeg/doc /usr/lib/btbn-ffmpeg/bin/ffplay
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# ffmpeg -> arm32
|
|
||||||
if [[ "${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
|
|
||||||
|
|
||||||
# ffmpeg -> arm64
|
# ffmpeg -> arm64
|
||||||
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
||||||
# add raspberry pi repo
|
mkdir -p /usr/lib/btbn-ffmpeg
|
||||||
gpg --no-default-keyring --keyring /usr/share/keyrings/raspbian.gpg --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E
|
wget -qO btbn-ffmpeg.tar.xz "https://github.com/BtbN/FFmpeg-Builds/releases/download/autobuild-2022-07-31-12-37/ffmpeg-n5.1-2-g915ef932a3-linuxarm64-gpl-5.1.tar.xz"
|
||||||
echo "deb [signed-by=/usr/share/keyrings/raspbian.gpg] https://archive.raspberrypi.org/debian/ bullseye main" | tee /etc/apt/sources.list.d/raspi.list
|
tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/btbn-ffmpeg --strip-components 1
|
||||||
apt-get -qq update
|
rm -rf btbn-ffmpeg.tar.xz /usr/lib/btbn-ffmpeg/doc /usr/lib/btbn-ffmpeg/bin/ffplay
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y ffmpeg
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# arch specific packages
|
# arch specific packages
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
||||||
# Use debian testing repo only for hwaccel packages
|
# use debian bookworm for AMD hwaccel packages
|
||||||
|
echo 'deb https://deb.debian.org/debian bookworm main contrib' >/etc/apt/sources.list.d/debian-bookworm.list
|
||||||
|
apt-get -qq update
|
||||||
|
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
||||||
|
mesa-va-drivers radeontop
|
||||||
|
rm -f /etc/apt/sources.list.d/debian-bookworm.list
|
||||||
|
|
||||||
|
# Use debian testing repo only for intel hwaccel packages
|
||||||
echo 'deb http://deb.debian.org/debian testing main non-free' >/etc/apt/sources.list.d/debian-testing.list
|
echo 'deb http://deb.debian.org/debian testing main non-free' >/etc/apt/sources.list.d/debian-testing.list
|
||||||
apt-get -qq update
|
apt-get -qq update
|
||||||
# intel-opencl-icd specifically for GPU support in OpenVino
|
# intel-opencl-icd specifically for GPU support in OpenVino
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
||||||
intel-opencl-icd \
|
intel-opencl-icd \
|
||||||
mesa-va-drivers libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1 radeontop intel-gpu-tools
|
libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1 intel-gpu-tools
|
||||||
# something about this dependency requires it to be installed in a separate call rather than in the line above
|
# something about this dependency requires it to be installed in a separate call rather than in the line above
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
||||||
i965-va-driver-shaders
|
i965-va-driver-shaders
|
||||||
@@ -75,17 +80,13 @@ if [[ "${TARGETARCH}" == "arm64" ]]; then
|
|||||||
libva-drm2 mesa-va-drivers
|
libva-drm2 mesa-va-drivers
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# not sure why 32bit arm requires all these
|
apt-get purge gnupg apt-transport-https xz-utils -y
|
||||||
if [[ "${TARGETARCH}" == "arm" ]]; then
|
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
|
||||||
libgtk-3-dev \
|
|
||||||
libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \
|
|
||||||
libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \
|
|
||||||
gfortran openexr libatlas-base-dev libtbb-dev libdc1394-22-dev libopenexr-dev \
|
|
||||||
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev
|
|
||||||
fi
|
|
||||||
|
|
||||||
apt-get purge gnupg apt-transport-https wget xz-utils -y
|
|
||||||
apt-get clean autoclean -y
|
apt-get clean autoclean -y
|
||||||
apt-get autoremove --purge -y
|
apt-get autoremove --purge -y
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Install yq, for frigate-prepare and go2rtc echo source
|
||||||
|
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
|
||||||
@@ -2,12 +2,10 @@
|
|||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
s6_version="3.1.4.1"
|
s6_version="3.1.5.0"
|
||||||
|
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
||||||
s6_arch="x86_64"
|
s6_arch="x86_64"
|
||||||
elif [[ "${TARGETARCH}" == "arm" ]]; then
|
|
||||||
s6_arch="armhf"
|
|
||||||
elif [[ "${TARGETARCH}" == "arm64" ]]; then
|
elif [[ "${TARGETARCH}" == "arm64" ]]; then
|
||||||
s6_arch="aarch64"
|
s6_arch="aarch64"
|
||||||
fi
|
fi
|
||||||
3
docker/main/requirements-dev.txt
Normal file
3
docker/main/requirements-dev.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
black == 23.3.*
|
||||||
|
isort
|
||||||
|
ruff
|
||||||
5
docker/main/requirements-ov.txt
Normal file
5
docker/main/requirements-ov.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
numpy
|
||||||
|
# Openvino Library - Custom built with MYRIAD support
|
||||||
|
openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.3.1/openvino-2022.3.1-1-cp39-cp39-manylinux_2_31_x86_64.whl; platform_machine == 'x86_64'
|
||||||
|
openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.3.1/openvino-2022.3.1-1-cp39-cp39-linux_aarch64.whl; platform_machine == 'aarch64'
|
||||||
|
openvino-dev[tensorflow2] @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.3.1/openvino_dev-2022.3.1-1-py3-none-any.whl
|
||||||
28
docker/main/requirements-wheels.txt
Normal file
28
docker/main/requirements-wheels.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
click == 8.1.*
|
||||||
|
Flask == 2.3.*
|
||||||
|
imutils == 0.5.*
|
||||||
|
matplotlib == 3.7.*
|
||||||
|
mypy == 1.4.1
|
||||||
|
numpy == 1.23.*
|
||||||
|
onvif_zeep == 0.2.12
|
||||||
|
opencv-python-headless == 4.7.0.*
|
||||||
|
paho-mqtt == 1.6.*
|
||||||
|
peewee == 3.16.*
|
||||||
|
peewee_migrate == 1.12.*
|
||||||
|
psutil == 5.9.*
|
||||||
|
pydantic == 1.10.*
|
||||||
|
git+https://github.com/fbcotter/py3nvml#egg=py3nvml
|
||||||
|
PyYAML == 6.0.*
|
||||||
|
pytz == 2023.3
|
||||||
|
ruamel.yaml == 0.17.*
|
||||||
|
tzlocal == 5.0.*
|
||||||
|
types-PyYAML == 6.0.*
|
||||||
|
requests == 2.31.*
|
||||||
|
types-requests == 2.31.*
|
||||||
|
scipy == 1.11.*
|
||||||
|
norfair == 2.2.*
|
||||||
|
setproctitle == 1.3.*
|
||||||
|
ws4py == 0.5.*
|
||||||
|
# Openvino Library - Custom built with MYRIAD support
|
||||||
|
openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.3.1/openvino-2022.3.1-1-cp39-cp39-manylinux_2_31_x86_64.whl; platform_machine == 'x86_64'
|
||||||
|
openvino @ https://github.com/NateMeyer/openvino-wheels/releases/download/multi-arch_2022.3.1/openvino-2022.3.1-1-cp39-cp39-linux_aarch64.whl; platform_machine == 'aarch64'
|
||||||
2
docker/main/requirements.txt
Normal file
2
docker/main/requirements.txt
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
scikit-build == 0.17.*
|
||||||
|
nvidia-pyindex
|
||||||
55
docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run
Executable file
55
docker/main/rootfs/etc/s6-overlay/s6-rc.d/frigate/run
Executable file
@@ -0,0 +1,55 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# Start the Frigate service
|
||||||
|
|
||||||
|
set -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
|
# Logs should be sent to stdout so that s6 can collect them
|
||||||
|
|
||||||
|
# Tell S6-Overlay not to restart this service
|
||||||
|
s6-svc -O .
|
||||||
|
|
||||||
|
function migrate_db_path() {
|
||||||
|
# Find config file in yaml or yml, but prefer yaml
|
||||||
|
local config_file="${CONFIG_FILE:-"/config/config.yml"}"
|
||||||
|
local config_file_yaml="${config_file//.yml/.yaml}"
|
||||||
|
if [[ -f "${config_file_yaml}" ]]; then
|
||||||
|
config_file="${config_file_yaml}"
|
||||||
|
elif [[ ! -f "${config_file}" ]]; then
|
||||||
|
echo "[ERROR] Frigate config file not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
unset config_file_yaml
|
||||||
|
|
||||||
|
# Use yq to check if database.path is set
|
||||||
|
local user_db_path
|
||||||
|
user_db_path=$(yq eval '.database.path' "${config_file}")
|
||||||
|
|
||||||
|
if [[ "${user_db_path}" == "null" ]]; then
|
||||||
|
local previous_db_path="/media/frigate/frigate.db"
|
||||||
|
local new_db_dir="/config"
|
||||||
|
if [[ -f "${previous_db_path}" ]]; then
|
||||||
|
if mountpoint --quiet "${new_db_dir}"; then
|
||||||
|
# /config is a mount point, move the db
|
||||||
|
echo "[INFO] Moving db from '${previous_db_path}' to the '${new_db_dir}' dir..."
|
||||||
|
# Move all files that starts with frigate.db to the new directory
|
||||||
|
mv -vf "${previous_db_path}"* "${new_db_dir}"
|
||||||
|
else
|
||||||
|
echo "[ERROR] Trying to migrate the db path from '${previous_db_path}' to the '${new_db_dir}' dir, but '${new_db_dir}' is not a mountpoint, please mount the '${new_db_dir}' dir"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "[INFO] Preparing Frigate..."
|
||||||
|
migrate_db_path
|
||||||
|
export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+')
|
||||||
|
|
||||||
|
echo "[INFO] Starting Frigate..."
|
||||||
|
|
||||||
|
cd /opt/frigate || echo "[ERROR] Failed to change working directory to /opt/frigate"
|
||||||
|
|
||||||
|
# Replace the bash process with the Frigate process, redirecting stderr to stdout
|
||||||
|
exec 2>&1
|
||||||
|
exec python3 -u -m frigate
|
||||||
@@ -43,6 +43,8 @@ function get_ip_and_port_from_supervisor() {
|
|||||||
export FRIGATE_GO2RTC_WEBRTC_CANDIDATE_INTERNAL="${ip_address}:${webrtc_port}"
|
export FRIGATE_GO2RTC_WEBRTC_CANDIDATE_INTERNAL="${ip_address}:${webrtc_port}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export LIBAVFORMAT_VERSION_MAJOR=$(ffmpeg -version | grep -Po 'libavformat\W+\K\d+')
|
||||||
|
|
||||||
if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
|
if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
|
||||||
echo "[INFO] Preparing go2rtc config..."
|
echo "[INFO] Preparing go2rtc config..."
|
||||||
|
|
||||||
@@ -54,8 +56,17 @@ if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
|
|||||||
python3 /usr/local/go2rtc/create_config.py
|
python3 /usr/local/go2rtc/create_config.py
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
readonly config_path="/config"
|
||||||
|
|
||||||
|
if [[ -x "${config_path}/go2rtc" ]]; then
|
||||||
|
readonly binary_path="${config_path}/go2rtc"
|
||||||
|
echo "[WARN] Using go2rtc binary from '${binary_path}' instead of the embedded one"
|
||||||
|
else
|
||||||
|
readonly binary_path="/usr/local/go2rtc/bin/go2rtc"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[INFO] Starting go2rtc..."
|
echo "[INFO] Starting go2rtc..."
|
||||||
|
|
||||||
# Replace the bash process with the go2rtc process, redirecting stderr to stdout
|
# Replace the bash process with the go2rtc process, redirecting stderr to stdout
|
||||||
exec 2>&1
|
exec 2>&1
|
||||||
exec go2rtc -config=/dev/shm/go2rtc.yaml
|
exec "${binary_path}" -config=/dev/shm/go2rtc.yaml
|
||||||
@@ -3,11 +3,14 @@
|
|||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import yaml
|
import yaml
|
||||||
|
|
||||||
sys.path.insert(0, "/opt/frigate")
|
sys.path.insert(0, "/opt/frigate")
|
||||||
from frigate.const import BIRDSEYE_PIPE, BTBN_PATH
|
from frigate.const import BIRDSEYE_PIPE # noqa: E402
|
||||||
from frigate.ffmpeg_presets import parse_preset_hardware_acceleration_encode
|
from frigate.ffmpeg_presets import ( # noqa: E402
|
||||||
|
parse_preset_hardware_acceleration_encode,
|
||||||
|
)
|
||||||
|
|
||||||
sys.path.remove("/opt/frigate")
|
sys.path.remove("/opt/frigate")
|
||||||
|
|
||||||
@@ -36,6 +39,10 @@ if go2rtc_config.get("api") is None:
|
|||||||
elif go2rtc_config["api"].get("origin") is None:
|
elif go2rtc_config["api"].get("origin") is None:
|
||||||
go2rtc_config["api"]["origin"] = "*"
|
go2rtc_config["api"]["origin"] = "*"
|
||||||
|
|
||||||
|
# Need to set default location for HA config
|
||||||
|
if go2rtc_config.get("hass") is None:
|
||||||
|
go2rtc_config["hass"] = {"config": "/config"}
|
||||||
|
|
||||||
# we want to ensure that logs are easy to read
|
# we want to ensure that logs are easy to read
|
||||||
if go2rtc_config.get("log") is None:
|
if go2rtc_config.get("log") is None:
|
||||||
go2rtc_config["log"] = {"format": "text"}
|
go2rtc_config["log"] = {"format": "text"}
|
||||||
@@ -64,11 +71,22 @@ else:
|
|||||||
# as source for frigate and the integration supports HLS playback
|
# as source for frigate and the integration supports HLS playback
|
||||||
if go2rtc_config.get("rtsp") is None:
|
if go2rtc_config.get("rtsp") is None:
|
||||||
go2rtc_config["rtsp"] = {"default_query": "mp4"}
|
go2rtc_config["rtsp"] = {"default_query": "mp4"}
|
||||||
elif go2rtc_config["rtsp"].get("default_query") is None:
|
else:
|
||||||
go2rtc_config["rtsp"]["default_query"] = "mp4"
|
if go2rtc_config["rtsp"].get("default_query") is None:
|
||||||
|
go2rtc_config["rtsp"]["default_query"] = "mp4"
|
||||||
|
|
||||||
|
if go2rtc_config["rtsp"].get("username") is not None:
|
||||||
|
go2rtc_config["rtsp"]["username"] = go2rtc_config["rtsp"]["username"].format(
|
||||||
|
**FRIGATE_ENV_VARS
|
||||||
|
)
|
||||||
|
|
||||||
|
if go2rtc_config["rtsp"].get("password") is not None:
|
||||||
|
go2rtc_config["rtsp"]["password"] = go2rtc_config["rtsp"]["password"].format(
|
||||||
|
**FRIGATE_ENV_VARS
|
||||||
|
)
|
||||||
|
|
||||||
# need to replace ffmpeg command when using ffmpeg4
|
# need to replace ffmpeg command when using ffmpeg4
|
||||||
if not os.path.exists(BTBN_PATH):
|
if int(os.environ["LIBAVFORMAT_VERSION_MAJOR"]) < 59:
|
||||||
if go2rtc_config.get("ffmpeg") is None:
|
if go2rtc_config.get("ffmpeg") is None:
|
||||||
go2rtc_config["ffmpeg"] = {
|
go2rtc_config["ffmpeg"] = {
|
||||||
"rtsp": "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
|
"rtsp": "-fflags nobuffer -flags low_delay -stimeout 5000000 -user_agent go2rtc/ffmpeg -rtsp_transport tcp -i {input}"
|
||||||
@@ -82,12 +100,25 @@ for name in go2rtc_config.get("streams", {}):
|
|||||||
stream = go2rtc_config["streams"][name]
|
stream = go2rtc_config["streams"][name]
|
||||||
|
|
||||||
if isinstance(stream, str):
|
if isinstance(stream, str):
|
||||||
go2rtc_config["streams"][name] = go2rtc_config["streams"][name].format(
|
try:
|
||||||
**FRIGATE_ENV_VARS
|
go2rtc_config["streams"][name] = go2rtc_config["streams"][name].format(
|
||||||
)
|
**FRIGATE_ENV_VARS
|
||||||
|
)
|
||||||
|
except KeyError as e:
|
||||||
|
print(
|
||||||
|
"[ERROR] Invalid substitution found, see https://docs.frigate.video/configuration/restream#advanced-restream-configurations for more info."
|
||||||
|
)
|
||||||
|
sys.exit(e)
|
||||||
|
|
||||||
elif isinstance(stream, list):
|
elif isinstance(stream, list):
|
||||||
for i, stream in enumerate(stream):
|
for i, stream in enumerate(stream):
|
||||||
go2rtc_config["streams"][name][i] = stream.format(**FRIGATE_ENV_VARS)
|
try:
|
||||||
|
go2rtc_config["streams"][name][i] = stream.format(**FRIGATE_ENV_VARS)
|
||||||
|
except KeyError as e:
|
||||||
|
print(
|
||||||
|
"[ERROR] Invalid substitution found, see https://docs.frigate.video/configuration/restream#advanced-restream-configurations for more info."
|
||||||
|
)
|
||||||
|
sys.exit(e)
|
||||||
|
|
||||||
# add birdseye restream stream if enabled
|
# add birdseye restream stream if enabled
|
||||||
if config.get("birdseye", {}).get("restream", False):
|
if config.get("birdseye", {}).get("restream", False):
|
||||||
@@ -93,10 +93,6 @@ http {
|
|||||||
secure_token $args;
|
secure_token $args;
|
||||||
secure_token_types application/vnd.apple.mpegurl;
|
secure_token_types application/vnd.apple.mpegurl;
|
||||||
|
|
||||||
add_header Access-Control-Allow-Headers '*';
|
|
||||||
add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
|
|
||||||
add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
|
|
||||||
add_header Access-Control-Allow-Origin '*';
|
|
||||||
add_header Cache-Control "no-store";
|
add_header Cache-Control "no-store";
|
||||||
expires off;
|
expires off;
|
||||||
}
|
}
|
||||||
@@ -104,16 +100,6 @@ http {
|
|||||||
location /stream/ {
|
location /stream/ {
|
||||||
add_header Cache-Control "no-store";
|
add_header Cache-Control "no-store";
|
||||||
expires off;
|
expires off;
|
||||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
|
||||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
|
||||||
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
|
||||||
if ($request_method = 'OPTIONS') {
|
|
||||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
|
||||||
add_header 'Access-Control-Max-Age' 1728000;
|
|
||||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
||||||
add_header 'Content-Length' 0;
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
|
|
||||||
types {
|
types {
|
||||||
application/dash+xml mpd;
|
application/dash+xml mpd;
|
||||||
@@ -126,16 +112,6 @@ http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location /clips/ {
|
location /clips/ {
|
||||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
|
||||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
|
||||||
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
|
||||||
if ($request_method = 'OPTIONS') {
|
|
||||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
|
||||||
add_header 'Access-Control-Max-Age' 1728000;
|
|
||||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
||||||
add_header 'Content-Length' 0;
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
|
|
||||||
types {
|
types {
|
||||||
video/mp4 mp4;
|
video/mp4 mp4;
|
||||||
@@ -152,17 +128,16 @@ http {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location /recordings/ {
|
location /recordings/ {
|
||||||
add_header 'Access-Control-Allow-Origin' "$http_origin" always;
|
types {
|
||||||
add_header 'Access-Control-Allow-Credentials' 'true';
|
video/mp4 mp4;
|
||||||
add_header 'Access-Control-Expose-Headers' 'Content-Length';
|
|
||||||
if ($request_method = 'OPTIONS') {
|
|
||||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
|
||||||
add_header 'Access-Control-Max-Age' 1728000;
|
|
||||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
|
||||||
add_header 'Content-Length' 0;
|
|
||||||
return 204;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
autoindex on;
|
||||||
|
autoindex_format json;
|
||||||
|
root /media/frigate;
|
||||||
|
}
|
||||||
|
|
||||||
|
location /exports/ {
|
||||||
types {
|
types {
|
||||||
video/mp4 mp4;
|
video/mp4 mp4;
|
||||||
}
|
}
|
||||||
@@ -204,9 +179,16 @@ http {
|
|||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ~* /api/go2rtc([/]?.*)$ {
|
||||||
|
proxy_pass http://go2rtc;
|
||||||
|
rewrite ^/api/go2rtc(.*)$ /api$1 break;
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "Upgrade";
|
||||||
|
proxy_set_header Host $host;
|
||||||
|
}
|
||||||
|
|
||||||
location ~* /api/.*\.(jpg|jpeg|png)$ {
|
location ~* /api/.*\.(jpg|jpeg|png)$ {
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
||||||
rewrite ^/api/(.*)$ $1 break;
|
rewrite ^/api/(.*)$ $1 break;
|
||||||
proxy_pass http://frigate_api;
|
proxy_pass http://frigate_api;
|
||||||
proxy_pass_request_headers on;
|
proxy_pass_request_headers on;
|
||||||
@@ -218,9 +200,6 @@ http {
|
|||||||
location /api/ {
|
location /api/ {
|
||||||
add_header Cache-Control "no-store";
|
add_header Cache-Control "no-store";
|
||||||
expires off;
|
expires off;
|
||||||
|
|
||||||
add_header 'Access-Control-Allow-Origin' '*';
|
|
||||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS';
|
|
||||||
proxy_pass http://frigate_api/;
|
proxy_pass http://frigate_api/;
|
||||||
proxy_pass_request_headers on;
|
proxy_pass_request_headers on;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Start the Frigate service
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
# Tell S6-Overlay not to restart this service
|
|
||||||
s6-svc -O .
|
|
||||||
|
|
||||||
echo "[INFO] Starting Frigate..."
|
|
||||||
|
|
||||||
cd /opt/frigate || echo "[ERROR] Failed to change working directory to /opt/frigate"
|
|
||||||
|
|
||||||
# Replace the bash process with the Frigate process, redirecting stderr to stdout
|
|
||||||
exec 2>&1
|
|
||||||
exec python3 -u -m frigate
|
|
||||||
16
docker/rpi/Dockerfile
Normal file
16
docker/rpi/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# syntax=docker/dockerfile:1.4
|
||||||
|
|
||||||
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
FROM deps AS rpi-deps
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
RUN rm -rf /usr/lib/btbn-ffmpeg/
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN --mount=type=bind,source=docker/rpi/install_deps.sh,target=/deps/install_deps.sh \
|
||||||
|
/deps/install_deps.sh
|
||||||
|
|
||||||
|
WORKDIR /opt/frigate/
|
||||||
|
COPY --from=rootfs / /
|
||||||
30
docker/rpi/install_deps.sh
Executable file
30
docker/rpi/install_deps.sh
Executable file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
apt-get -qq update
|
||||||
|
|
||||||
|
apt-get -qq install --no-install-recommends -y \
|
||||||
|
apt-transport-https \
|
||||||
|
gnupg \
|
||||||
|
wget \
|
||||||
|
procps vainfo \
|
||||||
|
unzip locales tzdata libxml2 xz-utils \
|
||||||
|
python3-pip \
|
||||||
|
curl \
|
||||||
|
jq \
|
||||||
|
nethogs
|
||||||
|
|
||||||
|
mkdir -p -m 600 /root/.gnupg
|
||||||
|
|
||||||
|
# enable non-free repo
|
||||||
|
sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list
|
||||||
|
|
||||||
|
# ffmpeg -> arm64
|
||||||
|
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
||||||
|
# add raspberry pi repo
|
||||||
|
gpg --no-default-keyring --keyring /usr/share/keyrings/raspbian.gpg --keyserver keyserver.ubuntu.com --recv-keys 82B129927FA3303E
|
||||||
|
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
|
||||||
|
fi
|
||||||
20
docker/rpi/rpi.hcl
Normal file
20
docker/rpi/rpi.hcl
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
target deps {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
platforms = ["linux/arm64"]
|
||||||
|
target = "deps"
|
||||||
|
}
|
||||||
|
|
||||||
|
target rootfs {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
platforms = ["linux/arm64"]
|
||||||
|
target = "rootfs"
|
||||||
|
}
|
||||||
|
|
||||||
|
target rpi {
|
||||||
|
dockerfile = "docker/rpi/Dockerfile"
|
||||||
|
contexts = {
|
||||||
|
deps = "target:deps",
|
||||||
|
rootfs = "target:rootfs"
|
||||||
|
}
|
||||||
|
platforms = ["linux/arm64"]
|
||||||
|
}
|
||||||
10
docker/rpi/rpi.mk
Normal file
10
docker/rpi/rpi.mk
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
BOARDS += rpi
|
||||||
|
|
||||||
|
local-rpi: version
|
||||||
|
docker buildx bake --load --file=docker/rpi/rpi.hcl --set rpi.tags=frigate:latest-rpi rpi
|
||||||
|
|
||||||
|
build-rpi: version
|
||||||
|
docker buildx bake --file=docker/rpi/rpi.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi rpi
|
||||||
|
|
||||||
|
push-rpi: build-rpi
|
||||||
|
docker buildx bake --push --file=docker/rpi/rpi.hcl --set rpi.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-rpi rpi
|
||||||
32
docker/tensorrt/Dockerfile.amd64
Normal file
32
docker/tensorrt/Dockerfile.amd64
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# syntax=docker/dockerfile:1.4
|
||||||
|
|
||||||
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# Make this a separate target so it can be built/cached optionally
|
||||||
|
FROM wheels as trt-wheels
|
||||||
|
ARG DEBIAN_FRONTEND
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
# Add TensorRT wheels to another folder
|
||||||
|
COPY docker/tensorrt/requirements-amd64.txt /requirements-tensorrt.txt
|
||||||
|
RUN mkdir -p /trt-wheels && pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt
|
||||||
|
|
||||||
|
FROM tensorrt-base AS frigate-tensorrt
|
||||||
|
ENV TRT_VER=8.5.3
|
||||||
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
|
pip3 install -U /deps/trt-wheels/*.whl && \
|
||||||
|
ldconfig
|
||||||
|
|
||||||
|
WORKDIR /opt/frigate/
|
||||||
|
COPY --from=rootfs / /
|
||||||
|
|
||||||
|
# Dev Container w/ TRT
|
||||||
|
FROM devcontainer AS devcontainer-trt
|
||||||
|
|
||||||
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
||||||
|
COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos
|
||||||
|
COPY docker/tensorrt/detector/rootfs/ /
|
||||||
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
||||||
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
|
pip3 install -U /deps/trt-wheels/*.whl
|
||||||
79
docker/tensorrt/Dockerfile.arm64
Normal file
79
docker/tensorrt/Dockerfile.arm64
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
# syntax=docker/dockerfile:1.4
|
||||||
|
|
||||||
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
ARG BASE_IMAGE
|
||||||
|
FROM ${BASE_IMAGE} AS build-wheels
|
||||||
|
ARG DEBIAN_FRONTEND
|
||||||
|
|
||||||
|
# Use a separate container to build wheels to prevent build dependencies in final image
|
||||||
|
RUN apt-get -qq update \
|
||||||
|
&& apt-get -qq install -y --no-install-recommends \
|
||||||
|
python3.9 python3.9-dev \
|
||||||
|
wget build-essential cmake git \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# Ensure python3 defaults to python3.9
|
||||||
|
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 1
|
||||||
|
|
||||||
|
RUN wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
||||||
|
&& python3 get-pip.py "pip"
|
||||||
|
|
||||||
|
|
||||||
|
FROM build-wheels AS trt-wheels
|
||||||
|
ARG DEBIAN_FRONTEND
|
||||||
|
ARG TARGETARCH
|
||||||
|
|
||||||
|
# python-tensorrt build deps are 3.4 GB!
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y ccache cuda-cudart-dev-* cuda-nvcc-* libnvonnxparsers-dev libnvparsers-dev libnvinfer-plugin-dev \
|
||||||
|
&& ([ -e /usr/local/cuda ] || ln -s /usr/local/cuda-* /usr/local/cuda) \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*;
|
||||||
|
|
||||||
|
# Determine version of tensorrt already installed in base image, e.g. "Version: 8.4.1-1+cuda11.4"
|
||||||
|
RUN NVINFER_VER=$(dpkg -s libnvinfer8 | grep -Po "Version: \K.*") \
|
||||||
|
&& echo $NVINFER_VER | grep -Po "^\d+\.\d+\.\d+" > /etc/TENSORRT_VER
|
||||||
|
|
||||||
|
RUN --mount=type=bind,source=docker/tensorrt/detector/build_python_tensorrt.sh,target=/deps/build_python_tensorrt.sh \
|
||||||
|
--mount=type=cache,target=/root/.ccache \
|
||||||
|
export PATH="/usr/lib/ccache:$PATH" CCACHE_DIR=/root/.ccache CCACHE_MAXSIZE=2G \
|
||||||
|
&& TENSORRT_VER=$(cat /etc/TENSORRT_VER) /deps/build_python_tensorrt.sh
|
||||||
|
|
||||||
|
COPY docker/tensorrt/requirements-arm64.txt /requirements-tensorrt.txt
|
||||||
|
RUN pip3 wheel --wheel-dir=/trt-wheels -r /requirements-tensorrt.txt
|
||||||
|
|
||||||
|
FROM build-wheels AS trt-model-wheels
|
||||||
|
ARG DEBIAN_FRONTEND
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y protobuf-compiler libprotobuf-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN --mount=type=bind,source=docker/tensorrt/requirements-models-arm64.txt,target=/requirements-tensorrt-models.txt \
|
||||||
|
pip3 wheel --wheel-dir=/trt-model-wheels -r /requirements-tensorrt-models.txt
|
||||||
|
|
||||||
|
FROM wget AS jetson-ffmpeg
|
||||||
|
ARG DEBIAN_FRONTEND
|
||||||
|
ENV CCACHE_DIR /root/.ccache
|
||||||
|
ENV CCACHE_MAXSIZE 2G
|
||||||
|
RUN --mount=type=bind,source=docker/tensorrt/build_jetson_ffmpeg.sh,target=/deps/build_jetson_ffmpeg.sh \
|
||||||
|
--mount=type=cache,target=/root/.ccache \
|
||||||
|
/deps/build_jetson_ffmpeg.sh
|
||||||
|
|
||||||
|
# Frigate w/ TensorRT for NVIDIA Jetson platforms
|
||||||
|
FROM tensorrt-base AS frigate-tensorrt
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y python-is-python3 libprotobuf17 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN rm -rf /usr/lib/btbn-ffmpeg/
|
||||||
|
COPY --from=jetson-ffmpeg /rootfs /
|
||||||
|
|
||||||
|
COPY --from=trt-wheels /etc/TENSORRT_VER /etc/TENSORRT_VER
|
||||||
|
RUN --mount=type=bind,from=trt-wheels,source=/trt-wheels,target=/deps/trt-wheels \
|
||||||
|
--mount=type=bind,from=trt-model-wheels,source=/trt-model-wheels,target=/deps/trt-model-wheels \
|
||||||
|
pip3 install -U /deps/trt-wheels/*.whl /deps/trt-model-wheels/*.whl \
|
||||||
|
&& ldconfig
|
||||||
|
|
||||||
|
WORKDIR /opt/frigate/
|
||||||
|
COPY --from=rootfs / /
|
||||||
29
docker/tensorrt/Dockerfile.base
Normal file
29
docker/tensorrt/Dockerfile.base
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
# syntax=docker/dockerfile:1.6
|
||||||
|
|
||||||
|
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
||||||
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
ARG TRT_BASE=nvcr.io/nvidia/tensorrt:23.03-py3
|
||||||
|
|
||||||
|
# Build TensorRT-specific library
|
||||||
|
FROM ${TRT_BASE} AS trt-deps
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y git build-essential cuda-nvcc-* cuda-nvtx-* libnvinfer-dev libnvinfer-plugin-dev libnvparsers-dev libnvonnxparsers-dev \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
RUN --mount=type=bind,source=docker/tensorrt/detector/tensorrt_libyolo.sh,target=/tensorrt_libyolo.sh \
|
||||||
|
/tensorrt_libyolo.sh
|
||||||
|
|
||||||
|
# Frigate w/ TensorRT Support as separate image
|
||||||
|
FROM deps AS tensorrt-base
|
||||||
|
|
||||||
|
#Disable S6 Global timeout
|
||||||
|
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
|
||||||
|
|
||||||
|
COPY --from=trt-deps /usr/local/lib/libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
||||||
|
COPY --from=trt-deps /usr/local/src/tensorrt_demos /usr/local/src/tensorrt_demos
|
||||||
|
COPY docker/tensorrt/detector/rootfs/ /
|
||||||
|
ENV YOLO_MODELS="yolov7-320"
|
||||||
|
|
||||||
|
HEALTHCHECK --start-period=600s --start-interval=5s --interval=15s --timeout=5s --retries=3 \
|
||||||
|
CMD curl --fail --silent --show-error http://127.0.0.1:5000/api/version || exit 1
|
||||||
59
docker/tensorrt/build_jetson_ffmpeg.sh
Executable file
59
docker/tensorrt/build_jetson_ffmpeg.sh
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# For jetson platforms, build ffmpeg with custom patches. NVIDIA supplies a deb
|
||||||
|
# with accelerated decoding, but it doesn't have accelerated scaling or encoding
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
INSTALL_PREFIX=/rootfs/usr/local
|
||||||
|
|
||||||
|
apt-get -qq update
|
||||||
|
apt-get -qq install -y --no-install-recommends build-essential ccache clang cmake pkg-config
|
||||||
|
apt-get -qq install -y --no-install-recommends libx264-dev libx265-dev
|
||||||
|
|
||||||
|
pushd /tmp
|
||||||
|
|
||||||
|
# Install libnvmpi to enable nvmpi decoders (h264_nvmpi, hevc_nvmpi)
|
||||||
|
if [ -e /usr/local/cuda-10.2 ]; then
|
||||||
|
# assume Jetpack 4.X
|
||||||
|
wget -q https://developer.nvidia.com/embedded/L4T/r32_Release_v5.0/T186/Jetson_Multimedia_API_R32.5.0_aarch64.tbz2 -O jetson_multimedia_api.tbz2
|
||||||
|
else
|
||||||
|
# assume Jetpack 5.X
|
||||||
|
wget -q https://developer.nvidia.com/downloads/embedded/l4t/r35_release_v3.1/release/jetson_multimedia_api_r35.3.1_aarch64.tbz2 -O jetson_multimedia_api.tbz2
|
||||||
|
fi
|
||||||
|
tar xaf jetson_multimedia_api.tbz2 -C / && rm jetson_multimedia_api.tbz2
|
||||||
|
|
||||||
|
wget -q https://github.com/madsciencetist/jetson-ffmpeg/archive/refs/heads/master.zip
|
||||||
|
unzip master.zip && rm master.zip && cd jetson-ffmpeg-master
|
||||||
|
LD_LIBRARY_PATH=$(pwd)/stubs:$LD_LIBRARY_PATH # tegra multimedia libs aren't available in image, so use stubs for ffmpeg build
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$INSTALL_PREFIX
|
||||||
|
make -j$(nproc)
|
||||||
|
make install
|
||||||
|
cd ../../
|
||||||
|
|
||||||
|
# Install nv-codec-headers to enable ffnvcodec filters (scale_cuda)
|
||||||
|
wget -q https://github.com/FFmpeg/nv-codec-headers/archive/refs/heads/master.zip
|
||||||
|
unzip master.zip && rm master.zip && cd nv-codec-headers-master
|
||||||
|
make PREFIX=$INSTALL_PREFIX install
|
||||||
|
cd ../ && rm -rf nv-codec-headers-master
|
||||||
|
|
||||||
|
# Build ffmpeg with nvmpi patch
|
||||||
|
wget -q https://ffmpeg.org/releases/ffmpeg-6.0.tar.xz
|
||||||
|
tar xaf ffmpeg-*.tar.xz && rm ffmpeg-*.tar.xz && cd ffmpeg-*
|
||||||
|
patch -p1 < ../jetson-ffmpeg-master/ffmpeg_patches/ffmpeg6.0_nvmpi.patch
|
||||||
|
export PKG_CONFIG_PATH=$INSTALL_PREFIX/lib/pkgconfig
|
||||||
|
# enable Jetson codecs but disable dGPU codecs
|
||||||
|
./configure --cc='ccache gcc' --cxx='ccache g++' \
|
||||||
|
--enable-shared --disable-static --prefix=$INSTALL_PREFIX \
|
||||||
|
--enable-gpl --enable-libx264 --enable-libx265 \
|
||||||
|
--enable-nvmpi --enable-ffnvcodec --enable-cuda-llvm \
|
||||||
|
--disable-cuvid --disable-nvenc --disable-nvdec \
|
||||||
|
|| { cat ffbuild/config.log && false; }
|
||||||
|
make -j$(nproc)
|
||||||
|
make install
|
||||||
|
cd ../
|
||||||
|
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
popd
|
||||||
28
docker/tensorrt/detector/build_python_tensorrt.sh
Executable file
28
docker/tensorrt/detector/build_python_tensorrt.sh
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
mkdir -p /trt-wheels
|
||||||
|
|
||||||
|
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
||||||
|
|
||||||
|
# NVIDIA supplies python-tensorrt for python3.8, but frigate uses python3.9,
|
||||||
|
# so we must build python-tensorrt ourselves.
|
||||||
|
|
||||||
|
# Get python-tensorrt source
|
||||||
|
mkdir /workspace
|
||||||
|
cd /workspace
|
||||||
|
git clone -b ${TENSORRT_VER} https://github.com/NVIDIA/TensorRT.git --depth=1
|
||||||
|
|
||||||
|
# Collect dependencies
|
||||||
|
EXT_PATH=/workspace/external && mkdir -p $EXT_PATH
|
||||||
|
pip3 install pybind11 && ln -s /usr/local/lib/python3.9/dist-packages/pybind11 $EXT_PATH/pybind11
|
||||||
|
ln -s /usr/include/python3.9 $EXT_PATH/python3.9
|
||||||
|
ln -s /usr/include/aarch64-linux-gnu/NvOnnxParser.h /workspace/TensorRT/parsers/onnx/
|
||||||
|
|
||||||
|
# Build wheel
|
||||||
|
cd /workspace/TensorRT/python
|
||||||
|
EXT_PATH=$EXT_PATH PYTHON_MAJOR_VERSION=3 PYTHON_MINOR_VERSION=9 TARGET_ARCHITECTURE=aarch64 /bin/bash ./build.sh
|
||||||
|
mv build/dist/*.whl /trt-wheels/
|
||||||
|
|
||||||
|
fi
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
/usr/local/lib
|
||||||
/usr/local/lib/python3.9/dist-packages/nvidia/cudnn/lib
|
/usr/local/lib/python3.9/dist-packages/nvidia/cudnn/lib
|
||||||
/usr/local/lib/python3.9/dist-packages/nvidia/cuda_runtime/lib
|
/usr/local/lib/python3.9/dist-packages/nvidia/cuda_runtime/lib
|
||||||
/usr/local/lib/python3.9/dist-packages/nvidia/cublas/lib
|
/usr/local/lib/python3.9/dist-packages/nvidia/cublas/lib
|
||||||
109
docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run
Executable file
109
docker/tensorrt/detector/rootfs/etc/s6-overlay/s6-rc.d/trt-model-prepare/run
Executable file
@@ -0,0 +1,109 @@
|
|||||||
|
#!/command/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
# Generate models for the TensorRT detector
|
||||||
|
|
||||||
|
# One or more comma-separated models may be specified via the YOLO_MODELS env.
|
||||||
|
# Append "-dla" to the model name to generate a DLA model with GPU fallback;
|
||||||
|
# otherwise a GPU-only model will be generated.
|
||||||
|
|
||||||
|
set -o errexit -o nounset -o pipefail
|
||||||
|
|
||||||
|
MODEL_CACHE_DIR=${MODEL_CACHE_DIR:-"/config/model_cache/tensorrt"}
|
||||||
|
TRT_VER=${TRT_VER:-$(cat /etc/TENSORRT_VER)}
|
||||||
|
OUTPUT_FOLDER="${MODEL_CACHE_DIR}/${TRT_VER}"
|
||||||
|
|
||||||
|
# Create output folder
|
||||||
|
mkdir -p ${OUTPUT_FOLDER}
|
||||||
|
|
||||||
|
FIRST_MODEL=true
|
||||||
|
MODEL_DOWNLOAD=""
|
||||||
|
MODEL_CONVERT=""
|
||||||
|
|
||||||
|
for model in ${YOLO_MODELS//,/ }
|
||||||
|
do
|
||||||
|
# Remove old link in case path/version changed
|
||||||
|
rm -f ${MODEL_CACHE_DIR}/${model}.trt
|
||||||
|
|
||||||
|
if [[ ! -f ${OUTPUT_FOLDER}/${model}.trt ]]; then
|
||||||
|
if [[ ${FIRST_MODEL} = true ]]; then
|
||||||
|
MODEL_DOWNLOAD="${model%-dla}";
|
||||||
|
MODEL_CONVERT="${model}"
|
||||||
|
FIRST_MODEL=false;
|
||||||
|
else
|
||||||
|
MODEL_DOWNLOAD+=",${model%-dla}";
|
||||||
|
MODEL_CONVERT+=",${model}";
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
ln -s ${OUTPUT_FOLDER}/${model}.trt ${MODEL_CACHE_DIR}/${model}.trt
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z ${MODEL_CONVERT} ]]; then
|
||||||
|
echo "No models to convert."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Setup ENV to select GPU for conversion
|
||||||
|
if [ ! -z ${TRT_MODEL_PREP_DEVICE+x} ]; then
|
||||||
|
if [ ! -z ${CUDA_VISIBLE_DEVICES+x} ]; then
|
||||||
|
PREVIOUS_CVD="$CUDA_VISIBLE_DEVICES"
|
||||||
|
unset CUDA_VISIBLE_DEVICES
|
||||||
|
fi
|
||||||
|
export CUDA_VISIBLE_DEVICES="$TRT_MODEL_PREP_DEVICE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# On Jetpack 4.6, the nvidia container runtime will mount several host nvidia libraries into the
|
||||||
|
# container which should not be present in the image - if they are, TRT model generation will
|
||||||
|
# fail or produce invalid models. Thus we must request the user to install them on the host in
|
||||||
|
# order to run libyolo here.
|
||||||
|
# On Jetpack 5.0, these libraries are not mounted by the runtime and are supplied by the image.
|
||||||
|
if [[ "$(arch)" == "aarch64" ]]; then
|
||||||
|
if [[ ! -e /usr/lib/aarch64-linux-gnu/tegra ]]; then
|
||||||
|
echo "ERROR: Container must be launched with nvidia runtime"
|
||||||
|
exit 1
|
||||||
|
elif [[ ! -e /usr/lib/aarch64-linux-gnu/libnvinfer.so.8 ||
|
||||||
|
! -e /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so.8 ||
|
||||||
|
! -e /usr/lib/aarch64-linux-gnu/libnvparsers.so.8 ||
|
||||||
|
! -e /usr/lib/aarch64-linux-gnu/libnvonnxparser.so.8 ]]; then
|
||||||
|
echo "ERROR: Please run the following on the HOST:"
|
||||||
|
echo " sudo apt install libnvinfer8 libnvinfer-plugin8 libnvparsers8 libnvonnxparsers8 nvidia-container"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Generating the following TRT Models: ${MODEL_CONVERT}"
|
||||||
|
|
||||||
|
# Build trt engine
|
||||||
|
cd /usr/local/src/tensorrt_demos/yolo
|
||||||
|
|
||||||
|
echo "Downloading yolo weights"
|
||||||
|
./download_yolo.sh $MODEL_DOWNLOAD 2> /dev/null
|
||||||
|
|
||||||
|
for model in ${MODEL_CONVERT//,/ }
|
||||||
|
do
|
||||||
|
python3 yolo_to_onnx.py -m ${model%-dla} > /dev/null
|
||||||
|
|
||||||
|
echo -e "\nGenerating ${model}.trt. This may take a few minutes.\n"; start=$(date +%s)
|
||||||
|
if [[ $model == *-dla ]]; then
|
||||||
|
cmd="python3 onnx_to_tensorrt.py -m ${model%-dla} --dla_core 0"
|
||||||
|
else
|
||||||
|
cmd="python3 onnx_to_tensorrt.py -m ${model}"
|
||||||
|
fi
|
||||||
|
$cmd > /tmp/onnx_to_tensorrt.log || { cat /tmp/onnx_to_tensorrt.log && continue; }
|
||||||
|
|
||||||
|
mv ${model%-dla}.trt ${OUTPUT_FOLDER}/${model}.trt;
|
||||||
|
ln -s ${OUTPUT_FOLDER}/${model}.trt ${MODEL_CACHE_DIR}/${model}.trt
|
||||||
|
echo "Generated ${model}.trt in $(($(date +%s)-start)) seconds"
|
||||||
|
done
|
||||||
|
|
||||||
|
# Restore ENV after conversion
|
||||||
|
if [ ! -z ${TRT_MODEL_PREP_DEVICE+x} ]; then
|
||||||
|
unset CUDA_VISIBLE_DEVICES
|
||||||
|
if [ ! -z ${PREVIOUS_CVD+x} ]; then
|
||||||
|
export CUDA_VISIBLE_DEVICES="$PREVIOUS_CVD"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Print which models exist in output folder
|
||||||
|
echo "Available tensorrt models:"
|
||||||
|
cd ${OUTPUT_FOLDER} && ls *.trt;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
oneshot
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/etc/s6-overlay/s6-rc.d/trt-model-prepare/run
|
||||||
21
docker/tensorrt/detector/tensorrt_libyolo.sh
Executable file
21
docker/tensorrt/detector/tensorrt_libyolo.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -euxo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="/usr/local/src/tensorrt_demos"
|
||||||
|
|
||||||
|
# Clone tensorrt_demos repo
|
||||||
|
git clone --depth 1 https://github.com/NateMeyer/tensorrt_demos.git -b conditional_download
|
||||||
|
|
||||||
|
# Build libyolo
|
||||||
|
if [ ! -e /usr/local/cuda ]; then
|
||||||
|
ln -s /usr/local/cuda-* /usr/local/cuda
|
||||||
|
fi
|
||||||
|
cd ./tensorrt_demos/plugins && make all -j$(nproc)
|
||||||
|
cp libyolo_layer.so /usr/local/lib/libyolo_layer.so
|
||||||
|
|
||||||
|
# Store yolo scripts for later conversion
|
||||||
|
cd ../
|
||||||
|
mkdir -p ${SCRIPT_DIR}/plugins
|
||||||
|
cp plugins/libyolo_layer.so ${SCRIPT_DIR}/plugins/libyolo_layer.so
|
||||||
|
cp -a yolo ${SCRIPT_DIR}/
|
||||||
12
docker/tensorrt/requirements-amd64.txt
Normal file
12
docker/tensorrt/requirements-amd64.txt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
# NVidia TensorRT Support (amd64 only)
|
||||||
|
--extra-index-url 'https://pypi.nvidia.com'
|
||||||
|
numpy < 1.24; platform_machine == 'x86_64'
|
||||||
|
tensorrt == 8.5.3.*; platform_machine == 'x86_64'
|
||||||
|
cuda-python == 11.8; platform_machine == 'x86_64'
|
||||||
|
cython == 0.29.*; platform_machine == 'x86_64'
|
||||||
|
nvidia-cuda-runtime-cu12 == 12.1.*; platform_machine == 'x86_64'
|
||||||
|
nvidia-cuda-runtime-cu11 == 11.8.*; platform_machine == 'x86_64'
|
||||||
|
nvidia-cublas-cu11 == 11.11.3.6; platform_machine == 'x86_64'
|
||||||
|
nvidia-cudnn-cu11 == 8.6.0.*; platform_machine == 'x86_64'
|
||||||
|
onnx==1.14.0; platform_machine == 'x86_64'
|
||||||
|
protobuf==3.20.3; platform_machine == 'x86_64'
|
||||||
1
docker/tensorrt/requirements-arm64.txt
Normal file
1
docker/tensorrt/requirements-arm64.txt
Normal file
@@ -0,0 +1 @@
|
|||||||
|
cuda-python == 11.7; platform_machine == 'aarch64'
|
||||||
3
docker/tensorrt/requirements-models-arm64.txt
Normal file
3
docker/tensorrt/requirements-models-arm64.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
onnx == 1.14.0; platform_machine == 'aarch64'
|
||||||
|
protobuf == 3.20.3; platform_machine == 'aarch64'
|
||||||
|
numpy == 1.23.*; platform_machine == 'aarch64' # required by python-tensorrt 8.2.1 (Jetpack 4.6)
|
||||||
94
docker/tensorrt/trt.hcl
Normal file
94
docker/tensorrt/trt.hcl
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
variable "ARCH" {
|
||||||
|
default = "amd64"
|
||||||
|
}
|
||||||
|
variable "BASE_IMAGE" {
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
variable "SLIM_BASE" {
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
variable "TRT_BASE" {
|
||||||
|
default = null
|
||||||
|
}
|
||||||
|
|
||||||
|
target "_build_args" {
|
||||||
|
args = {
|
||||||
|
BASE_IMAGE = BASE_IMAGE,
|
||||||
|
SLIM_BASE = SLIM_BASE,
|
||||||
|
TRT_BASE = TRT_BASE
|
||||||
|
}
|
||||||
|
platforms = ["linux/${ARCH}"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target wget {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
target = "wget"
|
||||||
|
inherits = ["_build_args"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target deps {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
target = "deps"
|
||||||
|
inherits = ["_build_args"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target rootfs {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
target = "rootfs"
|
||||||
|
inherits = ["_build_args"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target wheels {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
target = "wheels"
|
||||||
|
inherits = ["_build_args"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target devcontainer {
|
||||||
|
dockerfile = "docker/main/Dockerfile"
|
||||||
|
platforms = ["linux/amd64"]
|
||||||
|
target = "devcontainer"
|
||||||
|
}
|
||||||
|
|
||||||
|
target "trt-deps" {
|
||||||
|
dockerfile = "docker/tensorrt/Dockerfile.base"
|
||||||
|
context = "."
|
||||||
|
contexts = {
|
||||||
|
deps = "target:deps",
|
||||||
|
}
|
||||||
|
inherits = ["_build_args"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "tensorrt-base" {
|
||||||
|
dockerfile = "docker/tensorrt/Dockerfile.base"
|
||||||
|
context = "."
|
||||||
|
contexts = {
|
||||||
|
deps = "target:deps",
|
||||||
|
}
|
||||||
|
inherits = ["_build_args"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "tensorrt" {
|
||||||
|
dockerfile = "docker/tensorrt/Dockerfile.${ARCH}"
|
||||||
|
context = "."
|
||||||
|
contexts = {
|
||||||
|
wget = "target:wget",
|
||||||
|
tensorrt-base = "target:tensorrt-base",
|
||||||
|
rootfs = "target:rootfs"
|
||||||
|
wheels = "target:wheels"
|
||||||
|
}
|
||||||
|
target = "frigate-tensorrt"
|
||||||
|
inherits = ["_build_args"]
|
||||||
|
}
|
||||||
|
|
||||||
|
target "devcontainer-trt" {
|
||||||
|
dockerfile = "docker/tensorrt/Dockerfile.amd64"
|
||||||
|
context = "."
|
||||||
|
contexts = {
|
||||||
|
wheels = "target:wheels",
|
||||||
|
trt-deps = "target:trt-deps",
|
||||||
|
devcontainer = "target:devcontainer"
|
||||||
|
}
|
||||||
|
platforms = ["linux/amd64"]
|
||||||
|
target = "devcontainer-trt"
|
||||||
|
}
|
||||||
26
docker/tensorrt/trt.mk
Normal file
26
docker/tensorrt/trt.mk
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
BOARDS += trt
|
||||||
|
|
||||||
|
JETPACK4_BASE ?= timongentzsch/l4t-ubuntu20-opencv:latest # L4T 32.7.1 JetPack 4.6.1
|
||||||
|
JETPACK5_BASE ?= nvcr.io/nvidia/l4t-tensorrt:r8.5.2-runtime # L4T 35.3.1 JetPack 5.1.1
|
||||||
|
X86_DGPU_ARGS := ARCH=amd64
|
||||||
|
JETPACK4_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK4_BASE) SLIM_BASE=$(JETPACK4_BASE) TRT_BASE=$(JETPACK4_BASE)
|
||||||
|
JETPACK5_ARGS := ARCH=arm64 BASE_IMAGE=$(JETPACK5_BASE) SLIM_BASE=$(JETPACK5_BASE) TRT_BASE=$(JETPACK5_BASE)
|
||||||
|
|
||||||
|
local-trt: version
|
||||||
|
$(X86_DGPU_ARGS) docker buildx bake --load --file=docker/tensorrt/trt.hcl --set tensorrt.tags=frigate:latest-tensorrt tensorrt
|
||||||
|
|
||||||
|
local-trt-jp4: version
|
||||||
|
$(JETPACK4_ARGS) docker buildx bake --load --file=docker/tensorrt/trt.hcl --set tensorrt.tags=frigate:latest-tensorrt-jp4 tensorrt
|
||||||
|
|
||||||
|
local-trt-jp5: version
|
||||||
|
$(JETPACK5_ARGS) docker buildx bake --load --file=docker/tensorrt/trt.hcl --set tensorrt.tags=frigate:latest-tensorrt-jp5 tensorrt
|
||||||
|
|
||||||
|
build-trt:
|
||||||
|
$(X86_DGPU_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt tensorrt
|
||||||
|
$(JETPACK4_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4 tensorrt
|
||||||
|
$(JETPACK5_ARGS) docker buildx bake --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 tensorrt
|
||||||
|
|
||||||
|
push-trt: build-trt
|
||||||
|
$(X86_DGPU_ARGS) docker buildx bake --push --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt tensorrt
|
||||||
|
$(JETPACK4_ARGS) docker buildx bake --push --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp4 tensorrt
|
||||||
|
$(JETPACK5_ARGS) docker buildx bake --push --file=docker/tensorrt/trt.hcl --set tensorrt.tags=$(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH)-tensorrt-jp5 tensorrt
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
CUDA_HOME=/usr/local/cuda
|
|
||||||
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/usr/local/cuda/lib64:/usr/local/cuda/extras/CUPTI/lib64
|
|
||||||
OUTPUT_FOLDER=/tensorrt_models
|
|
||||||
echo "Generating the following TRT Models: ${YOLO_MODELS:="yolov4-tiny-288,yolov4-tiny-416,yolov7-tiny-416"}"
|
|
||||||
|
|
||||||
# Create output folder
|
|
||||||
mkdir -p ${OUTPUT_FOLDER}
|
|
||||||
|
|
||||||
# Install packages
|
|
||||||
pip install --upgrade pip && pip install onnx==1.9.0 protobuf==3.20.3
|
|
||||||
|
|
||||||
# Clone tensorrt_demos repo
|
|
||||||
git clone --depth 1 https://github.com/yeahme49/tensorrt_demos.git /tensorrt_demos
|
|
||||||
|
|
||||||
# Build libyolo
|
|
||||||
cd /tensorrt_demos/plugins && make all
|
|
||||||
cp libyolo_layer.so ${OUTPUT_FOLDER}/libyolo_layer.so
|
|
||||||
|
|
||||||
# Download yolo weights
|
|
||||||
cd /tensorrt_demos/yolo && ./download_yolo.sh
|
|
||||||
|
|
||||||
# Build trt engine
|
|
||||||
cd /tensorrt_demos/yolo
|
|
||||||
|
|
||||||
for model in ${YOLO_MODELS//,/ }
|
|
||||||
do
|
|
||||||
python3 yolo_to_onnx.py -m ${model}
|
|
||||||
python3 onnx_to_tensorrt.py -m ${model}
|
|
||||||
cp /tensorrt_demos/yolo/${model}.trt ${OUTPUT_FOLDER}/${model}.trt;
|
|
||||||
done
|
|
||||||
@@ -2,4 +2,4 @@
|
|||||||
|
|
||||||
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
|
This website is built using [Docusaurus 2](https://v2.docusaurus.io/), a modern static website generator.
|
||||||
|
|
||||||
For installation and contributing instructions, please follow the [Contributing Docs](https://blakeblackshear.github.io/frigate/contributing).
|
For installation and contributing instructions, please follow the [Contributing Docs](https://docs.frigate.video/development/contributing).
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ Examples of available modules are:
|
|||||||
- `frigate.app`
|
- `frigate.app`
|
||||||
- `frigate.mqtt`
|
- `frigate.mqtt`
|
||||||
- `frigate.object_detection`
|
- `frigate.object_detection`
|
||||||
- `frigate.zeroconf`
|
|
||||||
- `detector.<detector_name>`
|
- `detector.<detector_name>`
|
||||||
- `watchdog.<camera_name>`
|
- `watchdog.<camera_name>`
|
||||||
- `ffmpeg.<camera_name>.<sorted_roles>` NOTE: All FFmpeg logs are sent as `error` level.
|
- `ffmpeg.<camera_name>.<sorted_roles>` NOTE: All FFmpeg logs are sent as `error` level.
|
||||||
@@ -42,7 +41,7 @@ environment_vars:
|
|||||||
|
|
||||||
### `database`
|
### `database`
|
||||||
|
|
||||||
Event and recording information is managed in a sqlite database at `/media/frigate/frigate.db`. If that database is deleted, recordings will be orphaned and will need to be cleaned up manually. They also won't show up in the Media Browser within Home Assistant.
|
Event and recording information is managed in a sqlite database at `/config/frigate.db`. If that database is deleted, recordings will be orphaned and will need to be cleaned up manually. They also won't show up in the Media Browser within Home Assistant.
|
||||||
|
|
||||||
If you are storing your database on a network share (SMB, NFS, etc), you may get a `database is locked` error message on startup. You can customize the location of the database in the config if necessary.
|
If you are storing your database on a network share (SMB, NFS, etc), you may get a `database is locked` error message on startup. You can customize the location of the database in the config if necessary.
|
||||||
|
|
||||||
@@ -97,6 +96,16 @@ model:
|
|||||||
|
|
||||||
Note that if you rename objects in the labelmap, you will also need to update your `objects -> track` list as well.
|
Note that if you rename objects in the labelmap, you will also need to update your `objects -> track` list as well.
|
||||||
|
|
||||||
|
:::caution
|
||||||
|
|
||||||
|
Some labels have special handling and modifications can disable functionality.
|
||||||
|
|
||||||
|
`person` objects are associated with `face` and `amazon`
|
||||||
|
|
||||||
|
`car` objects are associated with `license_plate`, `ups`, `fedex`, `amazon`
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
## Custom ffmpeg build
|
## Custom ffmpeg build
|
||||||
|
|
||||||
Included with Frigate is a build of ffmpeg that works for the vast majority of users. However, there exists some hardware setups which have incompatibilities with the included build. In this case, a docker volume mapping can be used to overwrite the included ffmpeg build with an ffmpeg build that works for your specific hardware setup.
|
Included with Frigate is a build of ffmpeg that works for the vast majority of users. However, there exists some hardware setups which have incompatibilities with the included build. In this case, a docker volume mapping can be used to overwrite the included ffmpeg build with an ffmpeg build that works for your specific hardware setup.
|
||||||
@@ -108,3 +117,14 @@ To do this:
|
|||||||
3. Restart Frigate and the custom version will be used if the mapping was done correctly.
|
3. Restart Frigate and the custom version will be used if the mapping was done correctly.
|
||||||
|
|
||||||
NOTE: The folder that is mapped from the host needs to be the folder that contains `/bin`. So if the full structure is `/home/appdata/frigate/custom-ffmpeg/bin/ffmpeg` then `/home/appdata/frigate/custom-ffmpeg` needs to be mapped to `/usr/lib/btbn-ffmpeg`.
|
NOTE: The folder that is mapped from the host needs to be the folder that contains `/bin`. So if the full structure is `/home/appdata/frigate/custom-ffmpeg/bin/ffmpeg` then `/home/appdata/frigate/custom-ffmpeg` needs to be mapped to `/usr/lib/btbn-ffmpeg`.
|
||||||
|
|
||||||
|
## Custom go2rtc version
|
||||||
|
|
||||||
|
Frigate currently includes go2rtc v1.7.1, there may be certain cases where you want to run a different version of go2rtc.
|
||||||
|
|
||||||
|
To do this:
|
||||||
|
|
||||||
|
1. Download the go2rtc build to the /config folder.
|
||||||
|
2. Rename the build to `go2rtc`.
|
||||||
|
3. Give `go2rtc` execute permission.
|
||||||
|
4. Restart Frigate and the custom version will be used, you can verify by checking go2rtc logs.
|
||||||
|
|||||||
74
docs/docs/configuration/audio_detectors.md
Normal file
74
docs/docs/configuration/audio_detectors.md
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
---
|
||||||
|
id: audio_detectors
|
||||||
|
title: Audio Detectors
|
||||||
|
---
|
||||||
|
|
||||||
|
Frigate provides a builtin audio detector which runs on the CPU. Compared to object detection in images, audio detection is a relatively lightweight operation so the only option is to run the detection on a CPU.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Audio events work by detecting a type of audio and creating an event, the event will end once the type of audio has not been heard for the configured amount of time. Audio events save a snapshot at the beginning of the event as well as recordings throughout the event. The recordings are retained using the configured recording retention.
|
||||||
|
|
||||||
|
### Enabling Audio Events
|
||||||
|
|
||||||
|
Audio events can be enabled for all cameras or only for specific cameras.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
|
||||||
|
audio: # <- enable audio events for all camera
|
||||||
|
enabled: True
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
front_camera:
|
||||||
|
ffmpeg:
|
||||||
|
...
|
||||||
|
audio:
|
||||||
|
enabled: True # <- enable audio events for the front_camera
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are using multiple streams then you must set the `audio` role on the stream that is going to be used for audio detection, this can be any stream but the stream must have audio included.
|
||||||
|
|
||||||
|
:::note
|
||||||
|
|
||||||
|
The ffmpeg process for capturing audio will be a separate connection to the camera along with the other roles assigned to the camera, for this reason it is recommended that the go2rtc restream is used for this purpose. See [the restream docs](/configuration/restream.md) for more information.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
cameras:
|
||||||
|
front_camera:
|
||||||
|
ffmpeg:
|
||||||
|
inputs:
|
||||||
|
- path: rtsp://.../main_stream
|
||||||
|
roles:
|
||||||
|
- record
|
||||||
|
- path: rtsp://.../sub_stream # <- this stream must have audio enabled
|
||||||
|
roles:
|
||||||
|
- audio
|
||||||
|
- detect
|
||||||
|
```
|
||||||
|
|
||||||
|
### Configuring Minimum Volume
|
||||||
|
|
||||||
|
The audio detector uses volume levels in the same way that motion in a camera feed is used for object detection. This means that frigate will not run audio detection unless the audio volume is above the configured level in order to reduce resource usage. Audio levels can vary widely between camera models so it is important to run tests to see what volume levels are. MQTT explorer can be used on the audio topic to see what volume level is being detected.
|
||||||
|
|
||||||
|
:::tip
|
||||||
|
|
||||||
|
Volume is considered motion for recordings, this means when the `record -> retain -> mode` is set to `motion` any time audio volume is > min_volume that recording segment for that camera will be kept.
|
||||||
|
|
||||||
|
:::
|
||||||
|
|
||||||
|
### Configuring Audio Events
|
||||||
|
|
||||||
|
The included audio model has over [500 different types](https://github.com/blakeblackshear/frigate/blob/dev/audio-labelmap.txt) of audio that can be detected, many of which are not practical. By default `bark`, `fire_alarm`, `scream`, `speech`, and `yell` are enabled but these can be customized.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
audio:
|
||||||
|
enabled: True
|
||||||
|
listen:
|
||||||
|
- bark
|
||||||
|
- fire_alarm
|
||||||
|
- scream
|
||||||
|
- speech
|
||||||
|
- yell
|
||||||
|
```
|
||||||
126
docs/docs/configuration/autotracking.md
Normal file
126
docs/docs/configuration/autotracking.md
Normal file
@@ -0,0 +1,126 @@
|
|||||||
|
---
|
||||||
|
id: autotracking
|
||||||
|
title: Camera Autotracking
|
||||||
|
---
|
||||||
|
|
||||||
|
An ONVIF-capable, PTZ (pan-tilt-zoom) camera that supports relative movement within the field of view (FOV) can be configured to automatically track moving objects and keep them in the center of the frame.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Autotracking behavior
|
||||||
|
|
||||||
|
Once Frigate determines that an object is not a false positive and has entered one of the required zones, the autotracker will move the PTZ camera to keep the object centered in the frame until the object either moves out of the frame, the PTZ is not capable of any more movement, or Frigate loses track of it.
|
||||||
|
|
||||||
|
Upon loss of tracking, Frigate will scan the region of the lost object for `timeout` seconds. If an object of the same type is found in that region, Frigate will autotrack that new object.
|
||||||
|
|
||||||
|
When tracking has ended, Frigate will return to the camera firmware's PTZ preset specified by the `return_preset` configuration entry.
|
||||||
|
|
||||||
|
## Checking ONVIF camera support
|
||||||
|
|
||||||
|
Frigate autotracking functions with PTZ cameras capable of relative movement within the field of view (as specified in the [ONVIF spec](https://www.onvif.org/specs/srv/ptz/ONVIF-PTZ-Service-Spec-v1712.pdf) as `RelativePanTiltTranslationSpace` having a `TranslationSpaceFov` entry).
|
||||||
|
|
||||||
|
Many cheaper or older PTZs may not support this standard. Frigate will report an error message in the log and disable autotracking if your PTZ is unsupported.
|
||||||
|
|
||||||
|
Alternatively, you can download and run [this simple Python script](https://gist.github.com/hawkeye217/152a1d4ba80760dac95d46e143d37112), replacing the details on line 4 with your camera's IP address, ONVIF port, username, and password to check your camera.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
First, set up a PTZ preset in your camera's firmware and give it a name. If you're unsure how to do this, consult the documentation for your camera manufacturer's firmware. Some tutorials for common brands: [Amcrest](https://www.youtube.com/watch?v=lJlE9-krmrM), [Reolink](https://www.youtube.com/watch?v=VAnxHUY5i5w), [Dahua](https://www.youtube.com/watch?v=7sNbc5U-k54).
|
||||||
|
|
||||||
|
Edit your Frigate configuration file and enter the ONVIF parameters for your camera. Specify the object types to track, a required zone the object must enter to begin autotracking, and the camera preset name you configured in your camera's firmware to return to when tracking has ended. Optionally, specify a delay in seconds before Frigate returns the camera to the preset.
|
||||||
|
|
||||||
|
An [ONVIF connection](cameras.md) is required for autotracking to function.
|
||||||
|
|
||||||
|
Note that `autotracking` is disabled by default but can be enabled in the configuration or by MQTT.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
cameras:
|
||||||
|
ptzcamera:
|
||||||
|
...
|
||||||
|
onvif:
|
||||||
|
# Required: host of the camera being connected to.
|
||||||
|
host: 0.0.0.0
|
||||||
|
# Optional: ONVIF port for device (default: shown below).
|
||||||
|
port: 8000
|
||||||
|
# Optional: username for login.
|
||||||
|
# NOTE: Some devices require admin to access ONVIF.
|
||||||
|
user: admin
|
||||||
|
# Optional: password for login.
|
||||||
|
password: admin
|
||||||
|
# Optional: PTZ camera object autotracking. Keeps a moving object in
|
||||||
|
# the center of the frame by automatically moving the PTZ camera.
|
||||||
|
autotracking:
|
||||||
|
# Optional: enable/disable object autotracking. (default: shown below)
|
||||||
|
enabled: False
|
||||||
|
# Optional: calibrate the camera on startup (default: shown below)
|
||||||
|
# A calibration will move the PTZ in increments and measure the time it takes to move.
|
||||||
|
# The results are used to help estimate the position of tracked objects after a camera move.
|
||||||
|
# Frigate will update your config file automatically after a calibration with
|
||||||
|
# a "movement_weights" entry for the camera. You should then set calibrate_on_startup to False.
|
||||||
|
calibrate_on_startup: False
|
||||||
|
# Optional: the mode to use for zooming in/out on objects during autotracking. (default: shown below)
|
||||||
|
# Available options are: disabled, absolute, and relative
|
||||||
|
# disabled - don't zoom in/out on autotracked objects, use pan/tilt only
|
||||||
|
# absolute - use absolute zooming (supported by most PTZ capable cameras)
|
||||||
|
# relative - use relative zooming (not supported on all PTZs, but makes concurrent pan/tilt/zoom movements)
|
||||||
|
zooming: disabled
|
||||||
|
# Optional: A value to change the behavior of zooming on autotracked objects. (default: shown below)
|
||||||
|
# A lower value will keep more of the scene in view around a tracked object.
|
||||||
|
# A higher value will zoom in more on a tracked object, but Frigate may lose tracking more quickly.
|
||||||
|
# The value should be between 0.1 and 0.75
|
||||||
|
zoom_factor: 0.3
|
||||||
|
# Optional: list of objects to track from labelmap.txt (default: shown below)
|
||||||
|
track:
|
||||||
|
- person
|
||||||
|
# Required: Begin automatically tracking an object when it enters any of the listed zones.
|
||||||
|
required_zones:
|
||||||
|
- zone_name
|
||||||
|
# Required: Name of ONVIF preset in camera's firmware to return to when tracking is over. (default: shown below)
|
||||||
|
return_preset: home
|
||||||
|
# Optional: Seconds to delay before returning to preset. (default: shown below)
|
||||||
|
timeout: 10
|
||||||
|
# Optional: Values generated automatically by a camera calibration. Do not modify these manually. (default: shown below)
|
||||||
|
movement_weights: []
|
||||||
|
```
|
||||||
|
|
||||||
|
## Calibration
|
||||||
|
|
||||||
|
PTZ motors operate at different speeds. Performing a calibration will direct Frigate to measure this speed over a variety of movements and use those measurements to better predict the amount of movement necessary to keep autotracked objects in the center of the frame.
|
||||||
|
|
||||||
|
Calibration is optional, but will greatly assist Frigate in autotracking objects that move across the camera's field of view more quickly.
|
||||||
|
|
||||||
|
To begin calibration, set the `calibrate_on_startup` for your camera to `True` and restart Frigate. Frigate will then make a series of 30 small and large movements with your camera. Don't move the PTZ manually while calibration is in progress. Once complete, camera motion will stop and your config file will be automatically updated with a `movement_weights` parameter to be used in movement calculations. You should not modify this parameter manually.
|
||||||
|
|
||||||
|
After calibration has ended, your PTZ will be moved to the preset specified by `return_preset` and you should set `calibrate_on_startup` in your config file to `False`.
|
||||||
|
|
||||||
|
Note that Frigate will refine and update the `movement_weights` parameter in your config automatically as the PTZ moves during autotracking and more measurements are obtained.
|
||||||
|
|
||||||
|
You can recalibrate at any time by removing the `movement_weights` parameter, setting `calibrate_on_startup` to `True`, and then restarting Frigate. You may need to recalibrate or remove `movement_weights` from your config altogether if autotracking is erratic. If you change your `return_preset` in any way, a recalibration is also recommended.
|
||||||
|
|
||||||
|
## Best practices and considerations
|
||||||
|
|
||||||
|
Every PTZ camera is different, so autotracking may not perform ideally in every situation. This experimental feature was initially developed using an EmpireTech/Dahua SD1A404XB-GNR.
|
||||||
|
|
||||||
|
The object tracker in Frigate estimates the motion of the PTZ so that tracked objects are preserved when the camera moves. In most cases (especially for faster moving objects), the default 5 fps is insufficient for the motion estimator to perform accurately. 10 fps is the current recommendation. Higher frame rates will likely not be more performant and will only slow down Frigate and the motion estimator. Adjust your camera to output at least 10 frames per second and change the `fps` parameter in the [detect configuration](index.md) of your configuration file.
|
||||||
|
|
||||||
|
A fast [detector](object_detectors.md) is recommended. CPU detectors will not perform well or won't work at all. You can watch Frigate's debug viewer for your camera to see a thicker colored box around the object currently being autotracked.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
A full-frame zone in `required_zones` is not recommended, especially if you've calibrated your camera and there are `movement_weights` defined in the configuration file. Frigate will continue to autotrack an object that has entered one of the `required_zones`, even if it moves outside of that zone.
|
||||||
|
|
||||||
|
## Zooming
|
||||||
|
|
||||||
|
Zooming is still a very experimental feature and may use significantly more CPU when tracking objects than panning/tilting only. It may be helpful to tweak your camera's autofocus settings if you are noticing focus problems when using zooming.
|
||||||
|
|
||||||
|
Absolute zooming makes zoom movements separate from pan/tilt movements. Most PTZ cameras will support absolute zooming.
|
||||||
|
|
||||||
|
Relative zooming attempts to make a zoom movement concurrently with any pan/tilt movements. It was tested to work with some Dahua and Amcrest PTZs. But the ONVIF specification indicates that there no assumption about how the generic zoom range is mapped to magnification, field of view or other physical zoom dimension when using relative zooming. So if relative zooming behavior is erratic or just doesn't work, use absolute zooming.
|
||||||
|
|
||||||
|
You can optionally adjust the `zoom_factor` for your camera in your configuration file. Lower values will leave more space from the scene around the tracked object while higher values will cause your camera to zoom in more on the object. However, keep in mind that Frigate needs a fair amount of pixels and scene details outside of the bounding box of the tracked object to estimate the motion of your camera. If the object is taking up too much of the frame, Frigate will not be able to track the motion of the camera and your object will be lost.
|
||||||
|
|
||||||
|
The range of this option is from 0.1 to 0.75. The default value of 0.3 should be sufficient for most users. If you have a powerful zoom lens on your PTZ or you find your autotracked objects are often lost, you may want to lower this value. Because every PTZ and scene is different, you should experiment to determine what works best for you.
|
||||||
|
|
||||||
|
## Usage applications
|
||||||
|
|
||||||
|
In security and surveillance, it's common to use "spotter" cameras in combination with your PTZ. When your fixed spotter camera detects an object, you could use an automation platform like Home Assistant to move the PTZ to a specific preset so that Frigate can begin automatically tracking the object. For example: a residence may have fixed cameras on the east and west side of the property, capturing views up and down a street. When the spotter camera on the west side detects a person, a Home Assistant automation could move the PTZ to a camera preset aimed toward the west. When the object enters the specified zone, Frigate's autotracker could then continue to track the person as it moves out of view of any of the fixed cameras.
|
||||||
@@ -33,3 +33,25 @@ cameras:
|
|||||||
birdseye:
|
birdseye:
|
||||||
enabled: False
|
enabled: False
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Sorting cameras in the Birdseye view
|
||||||
|
|
||||||
|
It is possible to override the order of cameras that are being shown in the Birdseye view.
|
||||||
|
The order needs to be set at the camera level.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# Include all cameras by default in Birdseye view
|
||||||
|
birdseye:
|
||||||
|
enabled: True
|
||||||
|
mode: continuous
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
front:
|
||||||
|
birdseye:
|
||||||
|
order: 1
|
||||||
|
back:
|
||||||
|
birdseye:
|
||||||
|
order: 2
|
||||||
|
```
|
||||||
|
|
||||||
|
*Note*: Cameras are sorted by default using their name to ensure a constant view inside Birdseye.
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ Note that mjpeg cameras require encoding the video into h264 for recording, and
|
|||||||
```yaml
|
```yaml
|
||||||
go2rtc:
|
go2rtc:
|
||||||
streams:
|
streams:
|
||||||
mjpeg_cam: ffmpeg:{your_mjpeg_stream_url}#video=h264#hardware # <- use hardware acceleration to create an h264 stream usable for other components.
|
mjpeg_cam: "ffmpeg:{your_mjpeg_stream_url}#video=h264#hardware" # <- use hardware acceleration to create an h264 stream usable for other components.
|
||||||
|
|
||||||
cameras:
|
cameras:
|
||||||
...
|
...
|
||||||
@@ -80,8 +80,8 @@ cameras:
|
|||||||
rtmp:
|
rtmp:
|
||||||
enabled: False # <-- RTMP should be disabled if your stream is not H264
|
enabled: False # <-- RTMP should be disabled if your stream is not H264
|
||||||
detect:
|
detect:
|
||||||
width: # <---- update for your camera's resolution
|
width: # <- optional, by default Frigate tries to automatically detect resolution
|
||||||
height: # <---- update for your camera's resolution
|
height: # <- optional, by default Frigate tries to automatically detect resolution
|
||||||
```
|
```
|
||||||
|
|
||||||
### Blue Iris RTSP Cameras
|
### Blue Iris RTSP Cameras
|
||||||
@@ -108,21 +108,20 @@ According to [this discussion](https://github.com/blakeblackshear/frigate/issues
|
|||||||
```yaml
|
```yaml
|
||||||
go2rtc:
|
go2rtc:
|
||||||
streams:
|
streams:
|
||||||
reolink:
|
your_reolink_camera:
|
||||||
- http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password
|
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_main.bcs&user=username&password=password#video=copy#audio=copy#audio=opus"
|
||||||
- ffmpeg:reolink#audio=opus
|
your_reolink_camera_sub:
|
||||||
reolink_sub:
|
- "ffmpeg:http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=username&password=password"
|
||||||
- http://reolink_ip/flv?port=1935&app=bcs&stream=channel0_ext.bcs&user=username&password=password
|
|
||||||
|
|
||||||
cameras:
|
cameras:
|
||||||
reolink:
|
your_reolink_camera:
|
||||||
ffmpeg:
|
ffmpeg:
|
||||||
inputs:
|
inputs:
|
||||||
- path: rtsp://127.0.0.1:8554/reolink?video=copy&audio=aac
|
- path: rtsp://127.0.0.1:8554/your_reolink_camera
|
||||||
input_args: preset-rtsp-restream
|
input_args: preset-rtsp-restream
|
||||||
roles:
|
roles:
|
||||||
- record
|
- record
|
||||||
- path: rtsp://127.0.0.1:8554/reolink_sub?video=copy
|
- path: rtsp://127.0.0.1:8554/your_reolink_camera_sub
|
||||||
input_args: preset-rtsp-restream
|
input_args: preset-rtsp-restream
|
||||||
roles:
|
roles:
|
||||||
- detect
|
- detect
|
||||||
@@ -130,7 +129,18 @@ cameras:
|
|||||||
|
|
||||||
### Unifi Protect Cameras
|
### Unifi Protect Cameras
|
||||||
|
|
||||||
Unifi protect cameras require the rtspx stream to be used with go2rtc https://github.com/AlexxIT/go2rtc#source-rtsp
|
Unifi protect cameras require the rtspx stream to be used with go2rtc.
|
||||||
|
To utilize a Unifi protect camera, modify the rtsps link to begin with rtspx.
|
||||||
|
Additionally, remove the "?enableSrtp" from the end of the Unifi link.
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
go2rtc:
|
||||||
|
streams:
|
||||||
|
front:
|
||||||
|
- rtspx://192.168.1.1:7441/abcdefghijk
|
||||||
|
```
|
||||||
|
|
||||||
|
[See the go2rtc docs for more information](https://github.com/AlexxIT/go2rtc/tree/v1.7.1#source-rtsp)
|
||||||
|
|
||||||
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 and rtmp if used directly with unifi protect.
|
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 and rtmp if used directly with unifi protect.
|
||||||
|
|
||||||
@@ -140,3 +150,7 @@ ffmpeg:
|
|||||||
record: preset-record-ubiquiti
|
record: preset-record-ubiquiti
|
||||||
rtmp: preset-rtmp-ubiquiti # recommend using go2rtc instead
|
rtmp: preset-rtmp-ubiquiti # recommend using go2rtc instead
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### TP-Link VIGI Cameras
|
||||||
|
|
||||||
|
TP-Link VIGI cameras need some adjustments to the main stream settings on the camera itself to avoid issues. The stream needs to be configured as `H264` with `Smart Coding` set to `off`. Without these settings you may have problems when trying to watch recorded events. For example Firefox will stop playback after a few seconds and show the following error message: `The media playback was aborted due to a corruption problem or because the media used features your browser did not support.`.
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user