forked from Github/frigate
Compare commits
10 Commits
dependabot
...
v0.5.1-rc4
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c377b0b3bc | ||
|
|
ba272fc0e8 | ||
|
|
7ccf2ef694 | ||
|
|
68bfa6010d | ||
|
|
a810c56811 | ||
|
|
5333b8ae1b | ||
|
|
2bc57d271c | ||
|
|
8507bbbb31 | ||
|
|
b6fcb88e5c | ||
|
|
d3cd4afa65 |
@@ -1,168 +0,0 @@
|
|||||||
rtmp
|
|
||||||
edgetpu
|
|
||||||
labelmap
|
|
||||||
rockchip
|
|
||||||
jetson
|
|
||||||
rocm
|
|
||||||
vaapi
|
|
||||||
CUDA
|
|
||||||
hwaccel
|
|
||||||
RTSP
|
|
||||||
Hikvision
|
|
||||||
Dahua
|
|
||||||
Amcrest
|
|
||||||
Reolink
|
|
||||||
Loryta
|
|
||||||
Beelink
|
|
||||||
Celeron
|
|
||||||
vaapi
|
|
||||||
blakeblackshear
|
|
||||||
workdir
|
|
||||||
onvif
|
|
||||||
autotracking
|
|
||||||
openvino
|
|
||||||
tflite
|
|
||||||
deepstack
|
|
||||||
codeproject
|
|
||||||
udev
|
|
||||||
tailscale
|
|
||||||
restream
|
|
||||||
restreaming
|
|
||||||
webrtc
|
|
||||||
ssdlite
|
|
||||||
mobilenet
|
|
||||||
mosquitto
|
|
||||||
datasheet
|
|
||||||
Jellyfin
|
|
||||||
Radeon
|
|
||||||
libva
|
|
||||||
Ubiquiti
|
|
||||||
Unifi
|
|
||||||
Tapo
|
|
||||||
Annke
|
|
||||||
autotracker
|
|
||||||
autotracked
|
|
||||||
variations
|
|
||||||
ONVIF
|
|
||||||
traefik
|
|
||||||
devcontainer
|
|
||||||
rootfs
|
|
||||||
ffprobe
|
|
||||||
autotrack
|
|
||||||
logpipe
|
|
||||||
imread
|
|
||||||
imwrite
|
|
||||||
imencode
|
|
||||||
imutils
|
|
||||||
thresholded
|
|
||||||
timelapse
|
|
||||||
ultrafast
|
|
||||||
sleeptime
|
|
||||||
radeontop
|
|
||||||
vainfo
|
|
||||||
tmpfs
|
|
||||||
homography
|
|
||||||
websockets
|
|
||||||
LIBAVFORMAT
|
|
||||||
NTSC
|
|
||||||
onnxruntime
|
|
||||||
fourcc
|
|
||||||
radeonsi
|
|
||||||
paho
|
|
||||||
imagestream
|
|
||||||
jsonify
|
|
||||||
cgroups
|
|
||||||
sysconf
|
|
||||||
memlimit
|
|
||||||
gpuload
|
|
||||||
nvml
|
|
||||||
setproctitle
|
|
||||||
psutil
|
|
||||||
Kalman
|
|
||||||
frontdoor
|
|
||||||
namedtuples
|
|
||||||
zeep
|
|
||||||
fflags
|
|
||||||
probesize
|
|
||||||
wallclock
|
|
||||||
rknn
|
|
||||||
socs
|
|
||||||
pydantic
|
|
||||||
shms
|
|
||||||
imdecode
|
|
||||||
colormap
|
|
||||||
webui
|
|
||||||
mse
|
|
||||||
jsmpeg
|
|
||||||
unreviewed
|
|
||||||
Chromecast
|
|
||||||
Swipeable
|
|
||||||
flac
|
|
||||||
scroller
|
|
||||||
cmdline
|
|
||||||
toggleable
|
|
||||||
bottombar
|
|
||||||
opencv
|
|
||||||
apexcharts
|
|
||||||
buildx
|
|
||||||
mqtt
|
|
||||||
rawvideo
|
|
||||||
defragment
|
|
||||||
Norfair
|
|
||||||
subclassing
|
|
||||||
yolo
|
|
||||||
tensorrt
|
|
||||||
blackshear
|
|
||||||
stylelint
|
|
||||||
HACS
|
|
||||||
homeassistant
|
|
||||||
hass
|
|
||||||
castable
|
|
||||||
mobiledet
|
|
||||||
framebuffer
|
|
||||||
mjpeg
|
|
||||||
substream
|
|
||||||
codeowner
|
|
||||||
noninteractive
|
|
||||||
restreamed
|
|
||||||
mountpoint
|
|
||||||
fstype
|
|
||||||
OWASP
|
|
||||||
iotop
|
|
||||||
letsencrypt
|
|
||||||
fullchain
|
|
||||||
lsusb
|
|
||||||
iostat
|
|
||||||
usermod
|
|
||||||
balena
|
|
||||||
passwordless
|
|
||||||
debconf
|
|
||||||
dpkg
|
|
||||||
poweroff
|
|
||||||
surveillance
|
|
||||||
qnap
|
|
||||||
homekit
|
|
||||||
colorspace
|
|
||||||
quantisation
|
|
||||||
skylake
|
|
||||||
Cuvid
|
|
||||||
foscam
|
|
||||||
onnx
|
|
||||||
numpy
|
|
||||||
protobuf
|
|
||||||
aarch
|
|
||||||
amdgpu
|
|
||||||
chipset
|
|
||||||
referer
|
|
||||||
mpegts
|
|
||||||
webp
|
|
||||||
authelia
|
|
||||||
authentik
|
|
||||||
unichip
|
|
||||||
rebranded
|
|
||||||
udevadm
|
|
||||||
automations
|
|
||||||
unraid
|
|
||||||
hideable
|
|
||||||
healthcheck
|
|
||||||
keepalive
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Frigate Devcontainer",
|
|
||||||
"dockerComposeFile": "../docker-compose.yml",
|
|
||||||
"service": "devcontainer",
|
|
||||||
"workspaceFolder": "/workspace/frigate",
|
|
||||||
"initializeCommand": ".devcontainer/initialize.sh",
|
|
||||||
"postCreateCommand": ".devcontainer/post_create.sh",
|
|
||||||
"overrideCommand": false,
|
|
||||||
"remoteUser": "vscode",
|
|
||||||
"features": {
|
|
||||||
"ghcr.io/devcontainers/features/common-utils:1": {}
|
|
||||||
},
|
|
||||||
"forwardPorts": [8080, 5000, 5001, 5173, 8554, 8555],
|
|
||||||
"portsAttributes": {
|
|
||||||
"8080": {
|
|
||||||
"label": "External NGINX",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"5000": {
|
|
||||||
"label": "Internal NGINX",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"5001": {
|
|
||||||
"label": "Frigate API",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"5173": {
|
|
||||||
"label": "Vite Server",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"8554": {
|
|
||||||
"label": "gortc RTSP",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
},
|
|
||||||
"8555": {
|
|
||||||
"label": "go2rtc WebRTC",
|
|
||||||
"onAutoForward": "silent"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"customizations": {
|
|
||||||
"vscode": {
|
|
||||||
"extensions": [
|
|
||||||
"ms-python.python",
|
|
||||||
"ms-python.vscode-pylance",
|
|
||||||
"visualstudioexptteam.vscodeintellicode",
|
|
||||||
"mhutchie.git-graph",
|
|
||||||
"ms-azuretools.vscode-docker",
|
|
||||||
"streetsidesoftware.code-spell-checker",
|
|
||||||
"esbenp.prettier-vscode",
|
|
||||||
"dbaeumer.vscode-eslint",
|
|
||||||
"mikestead.dotenv",
|
|
||||||
"csstools.postcss",
|
|
||||||
"blanu.vscode-styled-jsx",
|
|
||||||
"bradlc.vscode-tailwindcss",
|
|
||||||
"charliermarsh.ruff"
|
|
||||||
],
|
|
||||||
"settings": {
|
|
||||||
"remote.autoForwardPorts": false,
|
|
||||||
"python.formatting.provider": "none",
|
|
||||||
"python.languageServer": "Pylance",
|
|
||||||
"editor.formatOnPaste": false,
|
|
||||||
"editor.formatOnSave": true,
|
|
||||||
"editor.formatOnType": true,
|
|
||||||
"python.testing.pytestEnabled": false,
|
|
||||||
"python.testing.unittestEnabled": true,
|
|
||||||
"python.testing.unittestArgs": ["-v", "-s", "./frigate/test"],
|
|
||||||
"files.trimTrailingWhitespace": true,
|
|
||||||
"eslint.workingDirectories": ["./web"],
|
|
||||||
"isort.args": ["--settings-path=./pyproject.toml"],
|
|
||||||
"[python]": {
|
|
||||||
"editor.defaultFormatter": "charliermarsh.ruff",
|
|
||||||
"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"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euo pipefail
|
|
||||||
|
|
||||||
# These folders needs to be created and owned by the host user
|
|
||||||
mkdir -p debug web/dist
|
|
||||||
|
|
||||||
if [[ -f "config/config.yml" ]]; then
|
|
||||||
echo "config/config.yml already exists, skipping initialization" >&2
|
|
||||||
else
|
|
||||||
echo "initializing config/config.yml" >&2
|
|
||||||
cp -fv config/config.yml.example config/config.yml
|
|
||||||
fi
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
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
|
|
||||||
# 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.
|
|
||||||
sudo mkdir -p /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
|
|
||||||
|
|
||||||
cd web
|
|
||||||
|
|
||||||
npm install
|
|
||||||
|
|
||||||
npm run build
|
|
||||||
@@ -1,16 +1,6 @@
|
|||||||
README.md
|
README.md
|
||||||
docs/
|
diagram.png
|
||||||
.gitignore
|
.gitignore
|
||||||
debug
|
debug
|
||||||
config/
|
config/
|
||||||
*.pyc
|
*.pyc
|
||||||
.git
|
|
||||||
core
|
|
||||||
*.mp4
|
|
||||||
*.jpg
|
|
||||||
*.db
|
|
||||||
*.ts
|
|
||||||
|
|
||||||
web/dist/
|
|
||||||
web/node_modules/
|
|
||||||
web/.npm
|
|
||||||
83
.github/DISCUSSION_TEMPLATE/bug-report.yml
vendored
83
.github/DISCUSSION_TEMPLATE/bug-report.yml
vendored
@@ -1,83 +0,0 @@
|
|||||||
title: "[Bug]: "
|
|
||||||
labels: ["bug", "triage"]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Describe the problem you are having
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: steps
|
|
||||||
attributes:
|
|
||||||
label: Steps to reproduce
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: Version
|
|
||||||
description: Visible on the System page in the Web UI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: config
|
|
||||||
attributes:
|
|
||||||
label: Frigate config file
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: os
|
|
||||||
attributes:
|
|
||||||
label: Operating system
|
|
||||||
options:
|
|
||||||
- HassOS
|
|
||||||
- Debian
|
|
||||||
- Other Linux
|
|
||||||
- Proxmox
|
|
||||||
- UNRAID
|
|
||||||
- Windows
|
|
||||||
- Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: install-method
|
|
||||||
attributes:
|
|
||||||
label: Install method
|
|
||||||
options:
|
|
||||||
- HassOS Addon
|
|
||||||
- Docker Compose
|
|
||||||
- Docker CLI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: network
|
|
||||||
attributes:
|
|
||||||
label: Network connection
|
|
||||||
options:
|
|
||||||
- Wired
|
|
||||||
- Wireless
|
|
||||||
- Mixed
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: camera
|
|
||||||
attributes:
|
|
||||||
label: Camera make and model
|
|
||||||
description: Dahua, hikvision, amcrest, reolink, etc and model number
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: other
|
|
||||||
attributes:
|
|
||||||
label: Any other information that may be helpful
|
|
||||||
104
.github/DISCUSSION_TEMPLATE/camera-support.yml
vendored
104
.github/DISCUSSION_TEMPLATE/camera-support.yml
vendored
@@ -1,104 +0,0 @@
|
|||||||
title: "[Camera Support]: "
|
|
||||||
labels: ["support", "triage"]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Describe the problem you are having
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: Version
|
|
||||||
description: Visible on the System page in the Web UI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: config
|
|
||||||
attributes:
|
|
||||||
label: Frigate config file
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: ffprobe
|
|
||||||
attributes:
|
|
||||||
label: FFprobe output from your camera
|
|
||||||
description: Run `ffprobe <camera_url>` and provide output below
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: stats
|
|
||||||
attributes:
|
|
||||||
label: Frigate stats
|
|
||||||
description: Output from frigate's /api/stats endpoint
|
|
||||||
render: json
|
|
||||||
- type: dropdown
|
|
||||||
id: os
|
|
||||||
attributes:
|
|
||||||
label: Operating system
|
|
||||||
options:
|
|
||||||
- HassOS
|
|
||||||
- Debian
|
|
||||||
- Other Linux
|
|
||||||
- Proxmox
|
|
||||||
- UNRAID
|
|
||||||
- Windows
|
|
||||||
- Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: install-method
|
|
||||||
attributes:
|
|
||||||
label: Install method
|
|
||||||
options:
|
|
||||||
- HassOS Addon
|
|
||||||
- Docker Compose
|
|
||||||
- Docker CLI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: object-detector
|
|
||||||
attributes:
|
|
||||||
label: Object Detector
|
|
||||||
options:
|
|
||||||
- Coral
|
|
||||||
- OpenVino
|
|
||||||
- TensorRT
|
|
||||||
- RKNN
|
|
||||||
- Other
|
|
||||||
- CPU (no coral)
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: network
|
|
||||||
attributes:
|
|
||||||
label: Network connection
|
|
||||||
options:
|
|
||||||
- Wired
|
|
||||||
- Wireless
|
|
||||||
- Mixed
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: camera
|
|
||||||
attributes:
|
|
||||||
label: Camera make and model
|
|
||||||
description: Dahua, hikvision, amcrest, reolink, etc and model number
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: other
|
|
||||||
attributes:
|
|
||||||
label: Any other information that may be helpful
|
|
||||||
79
.github/DISCUSSION_TEMPLATE/config-support.yml
vendored
79
.github/DISCUSSION_TEMPLATE/config-support.yml
vendored
@@ -1,79 +0,0 @@
|
|||||||
title: "[Config Support]: "
|
|
||||||
labels: ["support", "triage"]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Describe the problem you are having
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: Version
|
|
||||||
description: Visible on the System page in the Web UI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: config
|
|
||||||
attributes:
|
|
||||||
label: Frigate config file
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: stats
|
|
||||||
attributes:
|
|
||||||
label: Frigate stats
|
|
||||||
description: Output from frigate's /api/stats endpoint
|
|
||||||
render: json
|
|
||||||
- type: dropdown
|
|
||||||
id: os
|
|
||||||
attributes:
|
|
||||||
label: Operating system
|
|
||||||
options:
|
|
||||||
- HassOS
|
|
||||||
- Debian
|
|
||||||
- Other Linux
|
|
||||||
- Proxmox
|
|
||||||
- UNRAID
|
|
||||||
- Windows
|
|
||||||
- Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: install-method
|
|
||||||
attributes:
|
|
||||||
label: Install method
|
|
||||||
options:
|
|
||||||
- HassOS Addon
|
|
||||||
- Docker Compose
|
|
||||||
- Docker CLI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: object-detector
|
|
||||||
attributes:
|
|
||||||
label: Object Detector
|
|
||||||
options:
|
|
||||||
- Coral
|
|
||||||
- OpenVino
|
|
||||||
- TensorRT
|
|
||||||
- RKNN
|
|
||||||
- Other
|
|
||||||
- CPU (no coral)
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: other
|
|
||||||
attributes:
|
|
||||||
label: Any other information that may be helpful
|
|
||||||
81
.github/DISCUSSION_TEMPLATE/detector-support.yml
vendored
81
.github/DISCUSSION_TEMPLATE/detector-support.yml
vendored
@@ -1,81 +0,0 @@
|
|||||||
title: "[Detector Support]: "
|
|
||||||
labels: ["support", "triage"]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Describe the problem you are having
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: Version
|
|
||||||
description: Visible on the System page in the Web UI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: config
|
|
||||||
attributes:
|
|
||||||
label: Frigate config file
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: docker
|
|
||||||
attributes:
|
|
||||||
label: docker-compose file or Docker CLI command
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: os
|
|
||||||
attributes:
|
|
||||||
label: Operating system
|
|
||||||
options:
|
|
||||||
- HassOS
|
|
||||||
- Debian
|
|
||||||
- Other Linux
|
|
||||||
- Proxmox
|
|
||||||
- UNRAID
|
|
||||||
- Windows
|
|
||||||
- Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: install-method
|
|
||||||
attributes:
|
|
||||||
label: Install method
|
|
||||||
options:
|
|
||||||
- HassOS Addon
|
|
||||||
- Docker Compose
|
|
||||||
- Docker CLI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: object-detector
|
|
||||||
attributes:
|
|
||||||
label: Object Detector
|
|
||||||
options:
|
|
||||||
- Coral
|
|
||||||
- OpenVino
|
|
||||||
- TensorRT
|
|
||||||
- RKNN
|
|
||||||
- Other
|
|
||||||
- CPU (no coral)
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: other
|
|
||||||
attributes:
|
|
||||||
label: Any other information that may be helpful
|
|
||||||
104
.github/DISCUSSION_TEMPLATE/general-support.yml
vendored
104
.github/DISCUSSION_TEMPLATE/general-support.yml
vendored
@@ -1,104 +0,0 @@
|
|||||||
title: "[Support]: "
|
|
||||||
labels: ["support", "triage"]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Describe the problem you are having
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: Version
|
|
||||||
description: Visible on the System page in the Web UI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: config
|
|
||||||
attributes:
|
|
||||||
label: Frigate config file
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: ffprobe
|
|
||||||
attributes:
|
|
||||||
label: FFprobe output from your camera
|
|
||||||
description: Run `ffprobe <camera_url>` and provide output below
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: stats
|
|
||||||
attributes:
|
|
||||||
label: Frigate stats
|
|
||||||
description: Output from frigate's /api/stats endpoint
|
|
||||||
render: json
|
|
||||||
- type: dropdown
|
|
||||||
id: os
|
|
||||||
attributes:
|
|
||||||
label: Operating system
|
|
||||||
options:
|
|
||||||
- HassOS
|
|
||||||
- Debian
|
|
||||||
- Other Linux
|
|
||||||
- Proxmox
|
|
||||||
- UNRAID
|
|
||||||
- Windows
|
|
||||||
- Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: install-method
|
|
||||||
attributes:
|
|
||||||
label: Install method
|
|
||||||
options:
|
|
||||||
- HassOS Addon
|
|
||||||
- Docker Compose
|
|
||||||
- Docker CLI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: object-detector
|
|
||||||
attributes:
|
|
||||||
label: Object Detector
|
|
||||||
options:
|
|
||||||
- Coral
|
|
||||||
- OpenVino
|
|
||||||
- TensorRT
|
|
||||||
- RKNN
|
|
||||||
- Other
|
|
||||||
- CPU (no coral)
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: network
|
|
||||||
attributes:
|
|
||||||
label: Network connection
|
|
||||||
options:
|
|
||||||
- Wired
|
|
||||||
- Wireless
|
|
||||||
- Mixed
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: camera
|
|
||||||
attributes:
|
|
||||||
label: Camera make and model
|
|
||||||
description: Dahua, hikvision, amcrest, reolink, etc and model number
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: other
|
|
||||||
attributes:
|
|
||||||
label: Any other information that may be helpful
|
|
||||||
@@ -1,93 +0,0 @@
|
|||||||
title: "[HW Accel Support]: "
|
|
||||||
labels: ["support", "triage"]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Describe the problem you are having
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: version
|
|
||||||
attributes:
|
|
||||||
label: Version
|
|
||||||
description: Visible on the System page in the Web UI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: config
|
|
||||||
attributes:
|
|
||||||
label: Frigate config file
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: docker
|
|
||||||
attributes:
|
|
||||||
label: docker-compose file or Docker CLI command
|
|
||||||
description: This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: yaml
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: logs
|
|
||||||
attributes:
|
|
||||||
label: Relevant log output
|
|
||||||
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: ffprobe
|
|
||||||
attributes:
|
|
||||||
label: FFprobe output from your camera
|
|
||||||
description: Run `ffprobe <camera_url>` and provide output below
|
|
||||||
render: shell
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: os
|
|
||||||
attributes:
|
|
||||||
label: Operating system
|
|
||||||
options:
|
|
||||||
- HassOS
|
|
||||||
- Debian
|
|
||||||
- Other Linux
|
|
||||||
- Proxmox
|
|
||||||
- UNRAID
|
|
||||||
- Windows
|
|
||||||
- Other
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: install-method
|
|
||||||
attributes:
|
|
||||||
label: Install method
|
|
||||||
options:
|
|
||||||
- HassOS Addon
|
|
||||||
- Docker Compose
|
|
||||||
- Docker CLI
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: dropdown
|
|
||||||
id: network
|
|
||||||
attributes:
|
|
||||||
label: Network connection
|
|
||||||
options:
|
|
||||||
- Wired
|
|
||||||
- Wireless
|
|
||||||
- Mixed
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: input
|
|
||||||
id: camera
|
|
||||||
attributes:
|
|
||||||
label: Camera make and model
|
|
||||||
description: Dahua, hikvision, amcrest, reolink, etc and model number
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: other
|
|
||||||
attributes:
|
|
||||||
label: Any other information that may be helpful
|
|
||||||
9
.github/DISCUSSION_TEMPLATE/question.yml
vendored
9
.github/DISCUSSION_TEMPLATE/question.yml
vendored
@@ -1,9 +0,0 @@
|
|||||||
title: "[Question]: "
|
|
||||||
labels: ["question"]
|
|
||||||
body:
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: "What is your question:"
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
5
.github/FUNDING.yml
vendored
5
.github/FUNDING.yml
vendored
@@ -1,4 +1 @@
|
|||||||
github:
|
github: blakeblackshear
|
||||||
- blakeblackshear
|
|
||||||
- NickM-27
|
|
||||||
- hawkeye217
|
|
||||||
|
|||||||
8
.github/ISSUE_TEMPLATE/config.yml
vendored
8
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,8 +0,0 @@
|
|||||||
blank_issues_enabled: false
|
|
||||||
contact_links:
|
|
||||||
- name: Frigate Support
|
|
||||||
url: https://github.com/blakeblackshear/frigate/discussions/new/choose
|
|
||||||
about: Get support for setting up or troubleshooting Frigate.
|
|
||||||
- name: Frigate Bug Report
|
|
||||||
url: https://github.com/blakeblackshear/frigate/discussions/new/choose
|
|
||||||
about: Report a specific UI or backend bug.
|
|
||||||
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
20
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest an idea for this project
|
|
||||||
title: ''
|
|
||||||
labels: enhancement
|
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
**Describe what you are trying to accomplish and why in non technical terms**
|
|
||||||
I want to be able to ... so that I can ...
|
|
||||||
|
|
||||||
**Describe the solution you'd like**
|
|
||||||
A clear and concise description of what you want to happen.
|
|
||||||
|
|
||||||
**Describe alternatives you've considered**
|
|
||||||
A clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
**Additional context**
|
|
||||||
Add any other context or screenshots about the feature request here.
|
|
||||||
50
.github/actions/setup/action.yml
vendored
50
.github/actions/setup/action.yml
vendored
@@ -1,50 +0,0 @@
|
|||||||
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:
|
|
||||||
# Stop docker so we can mount more space at /var/lib/docker
|
|
||||||
- name: Stop docker
|
|
||||||
run: sudo systemctl stop docker
|
|
||||||
shell: bash
|
|
||||||
# This creates a virtual volume at /var/lib/docker to maximize the size
|
|
||||||
# As of 2/14/2024, this results in 97G for docker images
|
|
||||||
- name: Maximize build space
|
|
||||||
uses: easimon/maximize-build-space@master
|
|
||||||
with:
|
|
||||||
remove-dotnet: 'true'
|
|
||||||
remove-android: 'true'
|
|
||||||
remove-haskell: 'true'
|
|
||||||
remove-codeql: 'true'
|
|
||||||
build-mount-path: '/var/lib/docker'
|
|
||||||
- name: Start docker
|
|
||||||
run: sudo systemctl start docker
|
|
||||||
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
|
|
||||||
40
.github/dependabot.yml
vendored
40
.github/dependabot.yml
vendored
@@ -1,40 +0,0 @@
|
|||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
target-branch: dev
|
|
||||||
- package-ecosystem: "docker"
|
|
||||||
directory: "/docker"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
target-branch: dev
|
|
||||||
- package-ecosystem: "pip"
|
|
||||||
directory: "/docker/main"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
target-branch: dev
|
|
||||||
- package-ecosystem: "pip"
|
|
||||||
directory: "/docker/tensorrt"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
target-branch: dev
|
|
||||||
- package-ecosystem: "npm"
|
|
||||||
directory: "/web"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
target-branch: dev
|
|
||||||
- package-ecosystem: "npm"
|
|
||||||
directory: "/docs"
|
|
||||||
schedule:
|
|
||||||
interval: daily
|
|
||||||
allow:
|
|
||||||
- dependency-name: "@docusaurus/*"
|
|
||||||
open-pull-requests-limit: 10
|
|
||||||
target-branch: dev
|
|
||||||
235
.github/workflows/ci.yml
vendored
235
.github/workflows/ci.yml
vendored
@@ -1,235 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- dev
|
|
||||||
- master
|
|
||||||
|
|
||||||
# only run the latest commit to avoid cache overwrites
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
PYTHON_VERSION: 3.9
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
amd64_build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
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
|
|
||||||
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
|
|
||||||
- name: Build and push Rockchip build
|
|
||||||
uses: docker/bake-action@v3
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
targets: rk
|
|
||||||
files: docker/rockchip/rk.hcl
|
|
||||||
set: |
|
|
||||||
rk.tags=${{ steps.setup.outputs.image-name }}-rk
|
|
||||||
*.cache-from=type=gha
|
|
||||||
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
|
|
||||||
amd64_extra_builds:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: AMD64 Extra Build
|
|
||||||
needs:
|
|
||||||
- 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 TensorRT (x86 GPU)
|
|
||||||
env:
|
|
||||||
COMPUTE_LEVEL: "50 60 70 80 90"
|
|
||||||
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
|
|
||||||
#- name: AMD/ROCm general build
|
|
||||||
# env:
|
|
||||||
# AMDGPU: gfx
|
|
||||||
# HSA_OVERRIDE: 0
|
|
||||||
# uses: docker/bake-action@v3
|
|
||||||
# with:
|
|
||||||
# push: true
|
|
||||||
# targets: rocm
|
|
||||||
# files: docker/rocm/rocm.hcl
|
|
||||||
# set: |
|
|
||||||
# rocm.tags=${{ steps.setup.outputs.image-name }}-rocm
|
|
||||||
# *.cache-from=type=gha
|
|
||||||
#- name: AMD/ROCm gfx900
|
|
||||||
# env:
|
|
||||||
# AMDGPU: gfx900
|
|
||||||
# HSA_OVERRIDE: 1
|
|
||||||
# HSA_OVERRIDE_GFX_VERSION: 9.0.0
|
|
||||||
# uses: docker/bake-action@v3
|
|
||||||
# with:
|
|
||||||
# push: true
|
|
||||||
# targets: rocm
|
|
||||||
# files: docker/rocm/rocm.hcl
|
|
||||||
# set: |
|
|
||||||
# rocm.tags=${{ steps.setup.outputs.image-name }}-rocm-gfx900
|
|
||||||
# *.cache-from=type=gha
|
|
||||||
#- name: AMD/ROCm gfx1030
|
|
||||||
# env:
|
|
||||||
# AMDGPU: gfx1030
|
|
||||||
# HSA_OVERRIDE: 1
|
|
||||||
# HSA_OVERRIDE_GFX_VERSION: 10.3.0
|
|
||||||
# uses: docker/bake-action@v3
|
|
||||||
# with:
|
|
||||||
# push: true
|
|
||||||
# targets: rocm
|
|
||||||
# files: docker/rocm/rocm.hcl
|
|
||||||
# set: |
|
|
||||||
# rocm.tags=${{ steps.setup.outputs.image-name }}-rocm-gfx1030
|
|
||||||
# *.cache-from=type=gha
|
|
||||||
#- name: AMD/ROCm gfx1100
|
|
||||||
# env:
|
|
||||||
# AMDGPU: gfx1100
|
|
||||||
# HSA_OVERRIDE: 1
|
|
||||||
# HSA_OVERRIDE_GFX_VERSION: 11.0.0
|
|
||||||
# uses: docker/bake-action@v3
|
|
||||||
# with:
|
|
||||||
# push: true
|
|
||||||
# targets: rocm
|
|
||||||
# files: docker/rocm/rocm.hcl
|
|
||||||
# set: |
|
|
||||||
# rocm.tags=${{ steps.setup.outputs.image-name }}-rocm-gfx1100
|
|
||||||
# *.cache-from=type=gha
|
|
||||||
# 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:
|
|
||||||
- id: lowercaseRepo
|
|
||||||
uses: ASzc/change-string-case-action@v6
|
|
||||||
with:
|
|
||||||
string: ${{ github.repository }}
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Create short sha
|
|
||||||
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
|
|
||||||
- uses: int128/docker-manifest-create-action@v2
|
|
||||||
with:
|
|
||||||
tags: ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}
|
|
||||||
sources: |
|
|
||||||
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-amd64
|
|
||||||
ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}:${{ github.ref_name }}-${{ env.SHORT_SHA }}-rpi
|
|
||||||
24
.github/workflows/dependabot-auto-merge.yaml
vendored
24
.github/workflows/dependabot-auto-merge.yaml
vendored
@@ -1,24 +0,0 @@
|
|||||||
name: dependabot-auto-merge
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
dependabot-auto-merge:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: github.actor == 'dependabot[bot]'
|
|
||||||
steps:
|
|
||||||
- name: Get Dependabot metadata
|
|
||||||
id: metadata
|
|
||||||
uses: dependabot/fetch-metadata@v2
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- 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')
|
|
||||||
run: |
|
|
||||||
gh pr review --approve "$PR_URL"
|
|
||||||
gh pr merge --auto --squash "$PR_URL"
|
|
||||||
env:
|
|
||||||
PR_URL: ${{ github.event.pull_request.html_url }}
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
105
.github/workflows/pull_request.yml
vendored
105
.github/workflows/pull_request.yml
vendored
@@ -1,105 +0,0 @@
|
|||||||
name: On pull request
|
|
||||||
|
|
||||||
on: pull_request
|
|
||||||
|
|
||||||
env:
|
|
||||||
DEFAULT_PYTHON: 3.9
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build_devcontainer:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Build Devcontainer
|
|
||||||
# The Dockerfile contains features that requires buildkit, and since the
|
|
||||||
# devcontainer cli uses docker-compose to build the image, the only way to
|
|
||||||
# ensure docker-compose uses buildkit is to explicitly enable it.
|
|
||||||
env:
|
|
||||||
DOCKER_BUILDKIT: "1"
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@master
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
- name: Install devcontainer cli
|
|
||||||
run: npm install --global @devcontainers/cli
|
|
||||||
- name: Build devcontainer
|
|
||||||
run: devcontainer build --workspace-folder .
|
|
||||||
# It would be nice to also test the following commands, but for some
|
|
||||||
# reason they don't work even though in VS Code devcontainer works.
|
|
||||||
# - name: Start devcontainer
|
|
||||||
# run: devcontainer up --workspace-folder .
|
|
||||||
# - name: Run devcontainer scripts
|
|
||||||
# run: devcontainer run-user-commands --workspace-folder .
|
|
||||||
|
|
||||||
web_lint:
|
|
||||||
name: Web - Lint
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@master
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
- run: npm install
|
|
||||||
working-directory: ./web
|
|
||||||
- name: Lint
|
|
||||||
run: npm run lint
|
|
||||||
working-directory: ./web
|
|
||||||
|
|
||||||
web_test:
|
|
||||||
name: Web - Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@master
|
|
||||||
with:
|
|
||||||
node-version: 20.x
|
|
||||||
- run: npm install
|
|
||||||
working-directory: ./web
|
|
||||||
# - name: Test
|
|
||||||
# run: npm run test
|
|
||||||
# working-directory: ./web
|
|
||||||
|
|
||||||
python_checks:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Python Checks
|
|
||||||
steps:
|
|
||||||
- name: Check out the repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
|
|
||||||
uses: actions/setup-python@v5.1.0
|
|
||||||
with:
|
|
||||||
python-version: ${{ env.DEFAULT_PYTHON }}
|
|
||||||
- name: Install requirements
|
|
||||||
run: |
|
|
||||||
python3 -m pip install -U pip
|
|
||||||
python3 -m pip install -r docker/main/requirements-dev.txt
|
|
||||||
- name: Check formatting
|
|
||||||
run: |
|
|
||||||
ruff format --check --diff frigate migrations docker *.py
|
|
||||||
- name: Check lint
|
|
||||||
run: |
|
|
||||||
ruff check frigate migrations docker *.py
|
|
||||||
|
|
||||||
python_tests:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Python Tests
|
|
||||||
steps:
|
|
||||||
- name: Check out code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@master
|
|
||||||
with:
|
|
||||||
node-version: 16.x
|
|
||||||
- run: npm install
|
|
||||||
working-directory: ./web
|
|
||||||
- name: Build web
|
|
||||||
run: npm run build
|
|
||||||
working-directory: ./web
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
- name: Build
|
|
||||||
run: make
|
|
||||||
- name: Run mypy
|
|
||||||
run: docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate
|
|
||||||
- name: Run tests
|
|
||||||
run: docker run --rm --entrypoint=python3 frigate:latest -u -m unittest
|
|
||||||
47
.github/workflows/release.yml
vendored
47
.github/workflows/release.yml
vendored
@@ -1,47 +0,0 @@
|
|||||||
name: On release
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
release:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- id: lowercaseRepo
|
|
||||||
uses: ASzc/change-string-case-action@v6
|
|
||||||
with:
|
|
||||||
string: ${{ github.repository }}
|
|
||||||
- name: Log in to the Container registry
|
|
||||||
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
- name: Create tag variables
|
|
||||||
run: |
|
|
||||||
BRANCH=$([[ "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "master" || echo "dev")
|
|
||||||
echo "BRANCH=${BRANCH}" >> $GITHUB_ENV
|
|
||||||
echo "BASE=ghcr.io/${{ steps.lowercaseRepo.outputs.lowercase }}" >> $GITHUB_ENV
|
|
||||||
echo "BUILD_TAG=${BRANCH}-${GITHUB_SHA::7}" >> $GITHUB_ENV
|
|
||||||
echo "CLEAN_VERSION=$(echo ${GITHUB_REF##*/} | tr '[:upper:]' '[:lower:]' | sed 's/^[v]//')" >> $GITHUB_ENV
|
|
||||||
- name: Tag and push the main image
|
|
||||||
run: |
|
|
||||||
VERSION_TAG=${BASE}:${CLEAN_VERSION}
|
|
||||||
STABLE_TAG=${BASE}:stable
|
|
||||||
PULL_TAG=${BASE}:${BUILD_TAG}
|
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${VERSION_TAG}
|
|
||||||
for variant in standard-arm64 tensorrt tensorrt-jp4 tensorrt-jp5 rk; do
|
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${VERSION_TAG}-${variant}
|
|
||||||
done
|
|
||||||
|
|
||||||
# stable tag
|
|
||||||
if [[ "${BRANCH}" == "master" ]]; then
|
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG} docker://${STABLE_TAG}
|
|
||||||
for variant in standard-arm64 tensorrt tensorrt-jp4 tensorrt-jp5 rk; do
|
|
||||||
docker run --rm -v $HOME/.docker/config.json:/config.json quay.io/skopeo/stable:latest copy --authfile /config.json --multi-arch all docker://${PULL_TAG}-${variant} docker://${STABLE_TAG}-${variant}
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
41
.github/workflows/stale.yml
vendored
41
.github/workflows/stale.yml
vendored
@@ -1,41 +0,0 @@
|
|||||||
# Close Stale Issues
|
|
||||||
# Warns and then closes issues and PRs that have had no activity for a specified amount of time.
|
|
||||||
# https://github.com/actions/stale
|
|
||||||
|
|
||||||
name: "Stalebot"
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: "0 0 * * *" # run stalebot once a day
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
stale:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/stale@main
|
|
||||||
id: stale
|
|
||||||
with:
|
|
||||||
stale-issue-message: "This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions."
|
|
||||||
close-issue-message: ""
|
|
||||||
days-before-stale: 30
|
|
||||||
days-before-close: 3
|
|
||||||
exempt-draft-pr: true
|
|
||||||
exempt-issue-labels: "pinned,security"
|
|
||||||
exempt-pr-labels: "pinned,security,dependencies"
|
|
||||||
operations-per-run: 120
|
|
||||||
- name: Print outputs
|
|
||||||
run: echo ${{ join(steps.stale.outputs.*, ',') }}
|
|
||||||
|
|
||||||
clean_ghcr:
|
|
||||||
name: Delete outdated dev container images
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Delete old images
|
|
||||||
uses: snok/container-retention-policy@v2
|
|
||||||
with:
|
|
||||||
image-names: dev-*
|
|
||||||
cut-off: 60 days ago UTC
|
|
||||||
keep-at-least: 5
|
|
||||||
account-type: personal
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
token-type: github-token
|
|
||||||
|
|
||||||
22
.gitignore
vendored
22
.gitignore
vendored
@@ -1,20 +1,4 @@
|
|||||||
.DS_Store
|
*.pyc
|
||||||
*.pyc
|
|
||||||
*.swp
|
|
||||||
debug
|
debug
|
||||||
.vscode/*
|
.vscode
|
||||||
!.vscode/launch.json
|
config/config.yml
|
||||||
config/*
|
|
||||||
!config/*.example
|
|
||||||
models
|
|
||||||
*.mp4
|
|
||||||
*.db
|
|
||||||
*.csv
|
|
||||||
frigate/version.py
|
|
||||||
web/build
|
|
||||||
web/node_modules
|
|
||||||
web/coverage
|
|
||||||
core
|
|
||||||
!/web/**/*.ts
|
|
||||||
.idea/*
|
|
||||||
.ipynb_checkpoints
|
|
||||||
588
.pylintrc
588
.pylintrc
@@ -1,588 +0,0 @@
|
|||||||
[MASTER]
|
|
||||||
|
|
||||||
# A comma-separated list of package or module names from where C extensions may
|
|
||||||
# be loaded. Extensions are loading into the active Python interpreter and may
|
|
||||||
# run arbitrary code.
|
|
||||||
extension-pkg-whitelist=
|
|
||||||
|
|
||||||
# Specify a score threshold to be exceeded before program exits with error.
|
|
||||||
fail-under=10.0
|
|
||||||
|
|
||||||
# Add files or directories to the blacklist. They should be base names, not
|
|
||||||
# paths.
|
|
||||||
ignore=CVS
|
|
||||||
|
|
||||||
# Add files or directories matching the regex patterns to the blacklist. The
|
|
||||||
# regex matches against base names, not paths.
|
|
||||||
ignore-patterns=
|
|
||||||
|
|
||||||
# Python code to execute, usually for sys.path manipulation such as
|
|
||||||
# pygtk.require().
|
|
||||||
#init-hook=
|
|
||||||
|
|
||||||
# Use multiple processes to speed up Pylint. Specifying 0 will auto-detect the
|
|
||||||
# number of processors available to use.
|
|
||||||
jobs=1
|
|
||||||
|
|
||||||
# Control the amount of potential inferred values when inferring a single
|
|
||||||
# object. This can help the performance when dealing with large functions or
|
|
||||||
# complex, nested conditions.
|
|
||||||
limit-inference-results=100
|
|
||||||
|
|
||||||
# List of plugins (as comma separated values of python module names) to load,
|
|
||||||
# usually to register additional checkers.
|
|
||||||
load-plugins=
|
|
||||||
|
|
||||||
# Pickle collected data for later comparisons.
|
|
||||||
persistent=yes
|
|
||||||
|
|
||||||
# When enabled, pylint would attempt to guess common misconfiguration and emit
|
|
||||||
# user-friendly hints instead of false-positive error messages.
|
|
||||||
suggestion-mode=yes
|
|
||||||
|
|
||||||
# Allow loading of arbitrary C extensions. Extensions are imported into the
|
|
||||||
# active Python interpreter and may run arbitrary code.
|
|
||||||
unsafe-load-any-extension=no
|
|
||||||
|
|
||||||
|
|
||||||
[MESSAGES CONTROL]
|
|
||||||
|
|
||||||
# Only show warnings with the listed confidence levels. Leave empty to show
|
|
||||||
# all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED.
|
|
||||||
confidence=
|
|
||||||
|
|
||||||
# Disable the message, report, category or checker with the given id(s). You
|
|
||||||
# can either give multiple identifiers separated by comma (,) or put this
|
|
||||||
# option multiple times (only on the command line, not in the configuration
|
|
||||||
# file where it should appear only once). You can also use "--disable=all" to
|
|
||||||
# disable everything first and then reenable specific checks. For example, if
|
|
||||||
# you want to run only the similarities checker, you can use "--disable=all
|
|
||||||
# --enable=similarities". If you want to run only the classes checker, but have
|
|
||||||
# no Warning level messages displayed, use "--disable=all --enable=classes
|
|
||||||
# --disable=W".
|
|
||||||
disable=print-statement,
|
|
||||||
parameter-unpacking,
|
|
||||||
unpacking-in-except,
|
|
||||||
old-raise-syntax,
|
|
||||||
backtick,
|
|
||||||
long-suffix,
|
|
||||||
old-ne-operator,
|
|
||||||
old-octal-literal,
|
|
||||||
import-star-module-level,
|
|
||||||
non-ascii-bytes-literal,
|
|
||||||
raw-checker-failed,
|
|
||||||
bad-inline-option,
|
|
||||||
locally-disabled,
|
|
||||||
file-ignored,
|
|
||||||
suppressed-message,
|
|
||||||
useless-suppression,
|
|
||||||
deprecated-pragma,
|
|
||||||
use-symbolic-message-instead,
|
|
||||||
apply-builtin,
|
|
||||||
basestring-builtin,
|
|
||||||
buffer-builtin,
|
|
||||||
cmp-builtin,
|
|
||||||
coerce-builtin,
|
|
||||||
execfile-builtin,
|
|
||||||
file-builtin,
|
|
||||||
long-builtin,
|
|
||||||
raw_input-builtin,
|
|
||||||
reduce-builtin,
|
|
||||||
standarderror-builtin,
|
|
||||||
unicode-builtin,
|
|
||||||
xrange-builtin,
|
|
||||||
coerce-method,
|
|
||||||
delslice-method,
|
|
||||||
getslice-method,
|
|
||||||
setslice-method,
|
|
||||||
no-absolute-import,
|
|
||||||
old-division,
|
|
||||||
dict-iter-method,
|
|
||||||
dict-view-method,
|
|
||||||
next-method-called,
|
|
||||||
metaclass-assignment,
|
|
||||||
indexing-exception,
|
|
||||||
raising-string,
|
|
||||||
reload-builtin,
|
|
||||||
oct-method,
|
|
||||||
hex-method,
|
|
||||||
nonzero-method,
|
|
||||||
cmp-method,
|
|
||||||
input-builtin,
|
|
||||||
round-builtin,
|
|
||||||
intern-builtin,
|
|
||||||
unichr-builtin,
|
|
||||||
map-builtin-not-iterating,
|
|
||||||
zip-builtin-not-iterating,
|
|
||||||
range-builtin-not-iterating,
|
|
||||||
filter-builtin-not-iterating,
|
|
||||||
using-cmp-argument,
|
|
||||||
eq-without-hash,
|
|
||||||
div-method,
|
|
||||||
idiv-method,
|
|
||||||
rdiv-method,
|
|
||||||
exception-message-attribute,
|
|
||||||
invalid-str-codec,
|
|
||||||
sys-max-int,
|
|
||||||
bad-python3-import,
|
|
||||||
deprecated-string-function,
|
|
||||||
deprecated-str-translate-call,
|
|
||||||
deprecated-itertools-function,
|
|
||||||
deprecated-types-field,
|
|
||||||
next-method-defined,
|
|
||||||
dict-items-not-iterating,
|
|
||||||
dict-keys-not-iterating,
|
|
||||||
dict-values-not-iterating,
|
|
||||||
deprecated-operator-function,
|
|
||||||
deprecated-urllib-function,
|
|
||||||
xreadlines-attribute,
|
|
||||||
deprecated-sys-function,
|
|
||||||
exception-escape,
|
|
||||||
comprehension-escape
|
|
||||||
|
|
||||||
# Enable the message, report, category or checker with the given id(s). You can
|
|
||||||
# either give multiple identifier separated by comma (,) or put this option
|
|
||||||
# multiple time (only on the command line, not in the configuration file where
|
|
||||||
# it should appear only once). See also the "--disable" option for examples.
|
|
||||||
enable=c-extension-no-member
|
|
||||||
|
|
||||||
|
|
||||||
[REPORTS]
|
|
||||||
|
|
||||||
# Python expression which should return a score less than or equal to 10. You
|
|
||||||
# have access to the variables 'error', 'warning', 'refactor', and 'convention'
|
|
||||||
# which contain the number of messages in each category, as well as 'statement'
|
|
||||||
# which is the total number of statements analyzed. This score is used by the
|
|
||||||
# global evaluation report (RP0004).
|
|
||||||
evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10)
|
|
||||||
|
|
||||||
# Template used to display messages. This is a python new-style format string
|
|
||||||
# used to format the message information. See doc for all details.
|
|
||||||
#msg-template=
|
|
||||||
|
|
||||||
# Set the output format. Available formats are text, parseable, colorized, json
|
|
||||||
# and msvs (visual studio). You can also give a reporter class, e.g.
|
|
||||||
# mypackage.mymodule.MyReporterClass.
|
|
||||||
output-format=text
|
|
||||||
|
|
||||||
# Tells whether to display a full report or only the messages.
|
|
||||||
reports=no
|
|
||||||
|
|
||||||
# Activate the evaluation score.
|
|
||||||
score=yes
|
|
||||||
|
|
||||||
|
|
||||||
[REFACTORING]
|
|
||||||
|
|
||||||
# Maximum number of nested blocks for function / method body
|
|
||||||
max-nested-blocks=5
|
|
||||||
|
|
||||||
# Complete name of functions that never returns. When checking for
|
|
||||||
# inconsistent-return-statements if a never returning function is called then
|
|
||||||
# it will be considered as an explicit return statement and no message will be
|
|
||||||
# printed.
|
|
||||||
never-returning-functions=sys.exit
|
|
||||||
|
|
||||||
|
|
||||||
[SPELLING]
|
|
||||||
|
|
||||||
# Limits count of emitted suggestions for spelling mistakes.
|
|
||||||
max-spelling-suggestions=4
|
|
||||||
|
|
||||||
# Spelling dictionary name. Available dictionaries: none. To make it work,
|
|
||||||
# install the python-enchant package.
|
|
||||||
spelling-dict=
|
|
||||||
|
|
||||||
# List of comma separated words that should not be checked.
|
|
||||||
spelling-ignore-words=
|
|
||||||
|
|
||||||
# A path to a file that contains the private dictionary; one word per line.
|
|
||||||
spelling-private-dict-file=
|
|
||||||
|
|
||||||
# Tells whether to store unknown words to the private dictionary (see the
|
|
||||||
# --spelling-private-dict-file option) instead of raising a message.
|
|
||||||
spelling-store-unknown-words=no
|
|
||||||
|
|
||||||
|
|
||||||
[TYPECHECK]
|
|
||||||
|
|
||||||
# List of decorators that produce context managers, such as
|
|
||||||
# contextlib.contextmanager. Add to this list to register other decorators that
|
|
||||||
# produce valid context managers.
|
|
||||||
contextmanager-decorators=contextlib.contextmanager
|
|
||||||
|
|
||||||
# List of members which are set dynamically and missed by pylint inference
|
|
||||||
# system, and so shouldn't trigger E1101 when accessed. Python regular
|
|
||||||
# expressions are accepted.
|
|
||||||
generated-members=
|
|
||||||
|
|
||||||
# Tells whether missing members accessed in mixin class should be ignored. A
|
|
||||||
# mixin class is detected if its name ends with "mixin" (case insensitive).
|
|
||||||
ignore-mixin-members=yes
|
|
||||||
|
|
||||||
# Tells whether to warn about missing members when the owner of the attribute
|
|
||||||
# is inferred to be None.
|
|
||||||
ignore-none=yes
|
|
||||||
|
|
||||||
# This flag controls whether pylint should warn about no-member and similar
|
|
||||||
# checks whenever an opaque object is returned when inferring. The inference
|
|
||||||
# can return multiple potential results while evaluating a Python object, but
|
|
||||||
# some branches might not be evaluated, which results in partial inference. In
|
|
||||||
# that case, it might be useful to still emit no-member and other checks for
|
|
||||||
# the rest of the inferred objects.
|
|
||||||
ignore-on-opaque-inference=yes
|
|
||||||
|
|
||||||
# List of class names for which member attributes should not be checked (useful
|
|
||||||
# for classes with dynamically set attributes). This supports the use of
|
|
||||||
# qualified names.
|
|
||||||
ignored-classes=optparse.Values,thread._local,_thread._local
|
|
||||||
|
|
||||||
# List of module names for which member attributes should not be checked
|
|
||||||
# (useful for modules/projects where namespaces are manipulated during runtime
|
|
||||||
# and thus existing member attributes cannot be deduced by static analysis). It
|
|
||||||
# supports qualified module names, as well as Unix pattern matching.
|
|
||||||
ignored-modules=
|
|
||||||
|
|
||||||
# Show a hint with possible names when a member name was not found. The aspect
|
|
||||||
# of finding the hint is based on edit distance.
|
|
||||||
missing-member-hint=yes
|
|
||||||
|
|
||||||
# The minimum edit distance a name should have in order to be considered a
|
|
||||||
# similar match for a missing member name.
|
|
||||||
missing-member-hint-distance=1
|
|
||||||
|
|
||||||
# The total number of similar names that should be taken in consideration when
|
|
||||||
# showing a hint for a missing member.
|
|
||||||
missing-member-max-choices=1
|
|
||||||
|
|
||||||
# List of decorators that change the signature of a decorated function.
|
|
||||||
signature-mutators=
|
|
||||||
|
|
||||||
|
|
||||||
[STRING]
|
|
||||||
|
|
||||||
# This flag controls whether inconsistent-quotes generates a warning when the
|
|
||||||
# character used as a quote delimiter is used inconsistently within a module.
|
|
||||||
check-quote-consistency=no
|
|
||||||
|
|
||||||
# This flag controls whether the implicit-str-concat should generate a warning
|
|
||||||
# on implicit string concatenation in sequences defined over several lines.
|
|
||||||
check-str-concat-over-line-jumps=no
|
|
||||||
|
|
||||||
|
|
||||||
[FORMAT]
|
|
||||||
|
|
||||||
# Expected format of line ending, e.g. empty (any line ending), LF or CRLF.
|
|
||||||
expected-line-ending-format=
|
|
||||||
|
|
||||||
# Regexp for a line that is allowed to be longer than the limit.
|
|
||||||
ignore-long-lines=^\s*(# )?<?https?://\S+>?$
|
|
||||||
|
|
||||||
# Number of spaces of indent required inside a hanging or continued line.
|
|
||||||
indent-after-paren=4
|
|
||||||
|
|
||||||
# String used as indentation unit. This is usually " " (4 spaces) or "\t" (1
|
|
||||||
# tab).
|
|
||||||
indent-string=' '
|
|
||||||
|
|
||||||
# Maximum number of characters on a single line.
|
|
||||||
max-line-length=100
|
|
||||||
|
|
||||||
# Maximum number of lines in a module.
|
|
||||||
max-module-lines=1000
|
|
||||||
|
|
||||||
# Allow the body of a class to be on the same line as the declaration if body
|
|
||||||
# contains single statement.
|
|
||||||
single-line-class-stmt=no
|
|
||||||
|
|
||||||
# Allow the body of an if to be on the same line as the test if there is no
|
|
||||||
# else.
|
|
||||||
single-line-if-stmt=no
|
|
||||||
|
|
||||||
|
|
||||||
[SIMILARITIES]
|
|
||||||
|
|
||||||
# Ignore comments when computing similarities.
|
|
||||||
ignore-comments=yes
|
|
||||||
|
|
||||||
# Ignore docstrings when computing similarities.
|
|
||||||
ignore-docstrings=yes
|
|
||||||
|
|
||||||
# Ignore imports when computing similarities.
|
|
||||||
ignore-imports=no
|
|
||||||
|
|
||||||
# Minimum lines number of a similarity.
|
|
||||||
min-similarity-lines=4
|
|
||||||
|
|
||||||
|
|
||||||
[MISCELLANEOUS]
|
|
||||||
|
|
||||||
# List of note tags to take in consideration, separated by a comma.
|
|
||||||
notes=FIXME,
|
|
||||||
XXX,
|
|
||||||
TODO
|
|
||||||
|
|
||||||
# Regular expression of note tags to take in consideration.
|
|
||||||
#notes-rgx=
|
|
||||||
|
|
||||||
|
|
||||||
[BASIC]
|
|
||||||
|
|
||||||
# Naming style matching correct argument names.
|
|
||||||
argument-naming-style=snake_case
|
|
||||||
|
|
||||||
# Regular expression matching correct argument names. Overrides argument-
|
|
||||||
# naming-style.
|
|
||||||
#argument-rgx=
|
|
||||||
|
|
||||||
# Naming style matching correct attribute names.
|
|
||||||
attr-naming-style=snake_case
|
|
||||||
|
|
||||||
# Regular expression matching correct attribute names. Overrides attr-naming-
|
|
||||||
# style.
|
|
||||||
#attr-rgx=
|
|
||||||
|
|
||||||
# Bad variable names which should always be refused, separated by a comma.
|
|
||||||
bad-names=foo,
|
|
||||||
bar,
|
|
||||||
baz,
|
|
||||||
toto,
|
|
||||||
tutu,
|
|
||||||
tata
|
|
||||||
|
|
||||||
# Bad variable names regexes, separated by a comma. If names match any regex,
|
|
||||||
# they will always be refused
|
|
||||||
bad-names-rgxs=
|
|
||||||
|
|
||||||
# Naming style matching correct class attribute names.
|
|
||||||
class-attribute-naming-style=any
|
|
||||||
|
|
||||||
# Regular expression matching correct class attribute names. Overrides class-
|
|
||||||
# attribute-naming-style.
|
|
||||||
#class-attribute-rgx=
|
|
||||||
|
|
||||||
# Naming style matching correct class names.
|
|
||||||
class-naming-style=PascalCase
|
|
||||||
|
|
||||||
# Regular expression matching correct class names. Overrides class-naming-
|
|
||||||
# style.
|
|
||||||
#class-rgx=
|
|
||||||
|
|
||||||
# Naming style matching correct constant names.
|
|
||||||
const-naming-style=UPPER_CASE
|
|
||||||
|
|
||||||
# Regular expression matching correct constant names. Overrides const-naming-
|
|
||||||
# style.
|
|
||||||
#const-rgx=
|
|
||||||
|
|
||||||
# Minimum line length for functions/classes that require docstrings, shorter
|
|
||||||
# ones are exempt.
|
|
||||||
docstring-min-length=-1
|
|
||||||
|
|
||||||
# Naming style matching correct function names.
|
|
||||||
function-naming-style=snake_case
|
|
||||||
|
|
||||||
# Regular expression matching correct function names. Overrides function-
|
|
||||||
# naming-style.
|
|
||||||
#function-rgx=
|
|
||||||
|
|
||||||
# Good variable names which should always be accepted, separated by a comma.
|
|
||||||
good-names=i,
|
|
||||||
j,
|
|
||||||
k,
|
|
||||||
ex,
|
|
||||||
Run,
|
|
||||||
_
|
|
||||||
|
|
||||||
# Good variable names regexes, separated by a comma. If names match any regex,
|
|
||||||
# they will always be accepted
|
|
||||||
good-names-rgxs=
|
|
||||||
|
|
||||||
# Include a hint for the correct naming format with invalid-name.
|
|
||||||
include-naming-hint=no
|
|
||||||
|
|
||||||
# Naming style matching correct inline iteration names.
|
|
||||||
inlinevar-naming-style=any
|
|
||||||
|
|
||||||
# Regular expression matching correct inline iteration names. Overrides
|
|
||||||
# inlinevar-naming-style.
|
|
||||||
#inlinevar-rgx=
|
|
||||||
|
|
||||||
# Naming style matching correct method names.
|
|
||||||
method-naming-style=snake_case
|
|
||||||
|
|
||||||
# Regular expression matching correct method names. Overrides method-naming-
|
|
||||||
# style.
|
|
||||||
#method-rgx=
|
|
||||||
|
|
||||||
# Naming style matching correct module names.
|
|
||||||
module-naming-style=snake_case
|
|
||||||
|
|
||||||
# Regular expression matching correct module names. Overrides module-naming-
|
|
||||||
# style.
|
|
||||||
#module-rgx=
|
|
||||||
|
|
||||||
# Colon-delimited sets of names that determine each other's naming style when
|
|
||||||
# the name regexes allow several styles.
|
|
||||||
name-group=
|
|
||||||
|
|
||||||
# Regular expression which should only match function or class names that do
|
|
||||||
# not require a docstring.
|
|
||||||
no-docstring-rgx=^_
|
|
||||||
|
|
||||||
# List of decorators that produce properties, such as abc.abstractproperty. Add
|
|
||||||
# to this list to register other decorators that produce valid properties.
|
|
||||||
# These decorators are taken in consideration only for invalid-name.
|
|
||||||
property-classes=abc.abstractproperty
|
|
||||||
|
|
||||||
# Naming style matching correct variable names.
|
|
||||||
variable-naming-style=snake_case
|
|
||||||
|
|
||||||
# Regular expression matching correct variable names. Overrides variable-
|
|
||||||
# naming-style.
|
|
||||||
#variable-rgx=
|
|
||||||
|
|
||||||
|
|
||||||
[VARIABLES]
|
|
||||||
|
|
||||||
# List of additional names supposed to be defined in builtins. Remember that
|
|
||||||
# you should avoid defining new builtins when possible.
|
|
||||||
additional-builtins=
|
|
||||||
|
|
||||||
# Tells whether unused global variables should be treated as a violation.
|
|
||||||
allow-global-unused-variables=yes
|
|
||||||
|
|
||||||
# List of strings which can identify a callback function by name. A callback
|
|
||||||
# name must start or end with one of those strings.
|
|
||||||
callbacks=cb_,
|
|
||||||
_cb
|
|
||||||
|
|
||||||
# A regular expression matching the name of dummy variables (i.e. expected to
|
|
||||||
# not be used).
|
|
||||||
dummy-variables-rgx=_+$|(_[a-zA-Z0-9_]*[a-zA-Z0-9]+?$)|dummy|^ignored_|^unused_
|
|
||||||
|
|
||||||
# Argument names that match this expression will be ignored. Default to name
|
|
||||||
# with leading underscore.
|
|
||||||
ignored-argument-names=_.*|^ignored_|^unused_
|
|
||||||
|
|
||||||
# Tells whether we should check for unused import in __init__ files.
|
|
||||||
init-import=no
|
|
||||||
|
|
||||||
# List of qualified module names which can have objects that can redefine
|
|
||||||
# builtins.
|
|
||||||
redefining-builtins-modules=six.moves,past.builtins,future.builtins,builtins,io
|
|
||||||
|
|
||||||
|
|
||||||
[LOGGING]
|
|
||||||
|
|
||||||
# The type of string formatting that logging methods do. `old` means using %
|
|
||||||
# formatting, `new` is for `{}` formatting.
|
|
||||||
logging-format-style=fstr
|
|
||||||
|
|
||||||
# Logging modules to check that the string format arguments are in logging
|
|
||||||
# function parameter format.
|
|
||||||
logging-modules=logging
|
|
||||||
|
|
||||||
|
|
||||||
[DESIGN]
|
|
||||||
|
|
||||||
# Maximum number of arguments for function / method.
|
|
||||||
max-args=5
|
|
||||||
|
|
||||||
# Maximum number of attributes for a class (see R0902).
|
|
||||||
max-attributes=7
|
|
||||||
|
|
||||||
# Maximum number of boolean expressions in an if statement (see R0916).
|
|
||||||
max-bool-expr=5
|
|
||||||
|
|
||||||
# Maximum number of branch for function / method body.
|
|
||||||
max-branches=12
|
|
||||||
|
|
||||||
# Maximum number of locals for function / method body.
|
|
||||||
max-locals=15
|
|
||||||
|
|
||||||
# Maximum number of parents for a class (see R0901).
|
|
||||||
max-parents=7
|
|
||||||
|
|
||||||
# Maximum number of public methods for a class (see R0904).
|
|
||||||
max-public-methods=20
|
|
||||||
|
|
||||||
# Maximum number of return / yield for function / method body.
|
|
||||||
max-returns=6
|
|
||||||
|
|
||||||
# Maximum number of statements in function / method body.
|
|
||||||
max-statements=50
|
|
||||||
|
|
||||||
# Minimum number of public methods for a class (see R0903).
|
|
||||||
min-public-methods=2
|
|
||||||
|
|
||||||
|
|
||||||
[CLASSES]
|
|
||||||
|
|
||||||
# List of method names used to declare (i.e. assign) instance attributes.
|
|
||||||
defining-attr-methods=__init__,
|
|
||||||
__new__,
|
|
||||||
setUp,
|
|
||||||
__post_init__
|
|
||||||
|
|
||||||
# List of member names, which should be excluded from the protected access
|
|
||||||
# warning.
|
|
||||||
exclude-protected=_asdict,
|
|
||||||
_fields,
|
|
||||||
_replace,
|
|
||||||
_source,
|
|
||||||
_make
|
|
||||||
|
|
||||||
# List of valid names for the first argument in a class method.
|
|
||||||
valid-classmethod-first-arg=cls
|
|
||||||
|
|
||||||
# List of valid names for the first argument in a metaclass class method.
|
|
||||||
valid-metaclass-classmethod-first-arg=cls
|
|
||||||
|
|
||||||
|
|
||||||
[IMPORTS]
|
|
||||||
|
|
||||||
# List of modules that can be imported at any level, not just the top level
|
|
||||||
# one.
|
|
||||||
allow-any-import-level=
|
|
||||||
|
|
||||||
# Allow wildcard imports from modules that define __all__.
|
|
||||||
allow-wildcard-with-all=no
|
|
||||||
|
|
||||||
# Analyse import fallback blocks. This can be used to support both Python 2 and
|
|
||||||
# 3 compatible code, which means that the block might have code that exists
|
|
||||||
# only in one or another interpreter, leading to false positives when analysed.
|
|
||||||
analyse-fallback-blocks=no
|
|
||||||
|
|
||||||
# Deprecated modules which should not be used, separated by a comma.
|
|
||||||
deprecated-modules=optparse,tkinter.tix
|
|
||||||
|
|
||||||
# Create a graph of external dependencies in the given file (report RP0402 must
|
|
||||||
# not be disabled).
|
|
||||||
ext-import-graph=
|
|
||||||
|
|
||||||
# Create a graph of every (i.e. internal and external) dependencies in the
|
|
||||||
# given file (report RP0402 must not be disabled).
|
|
||||||
import-graph=
|
|
||||||
|
|
||||||
# Create a graph of internal dependencies in the given file (report RP0402 must
|
|
||||||
# not be disabled).
|
|
||||||
int-import-graph=
|
|
||||||
|
|
||||||
# Force import order to recognize a module as part of the standard
|
|
||||||
# compatibility libraries.
|
|
||||||
known-standard-library=
|
|
||||||
|
|
||||||
# Force import order to recognize a module as part of a third party library.
|
|
||||||
known-third-party=enchant
|
|
||||||
|
|
||||||
# Couples of modules and preferred modules, separated by a comma.
|
|
||||||
preferred-modules=
|
|
||||||
|
|
||||||
|
|
||||||
[EXCEPTIONS]
|
|
||||||
|
|
||||||
# Exceptions that will emit a warning when being caught. Defaults to
|
|
||||||
# "BaseException, Exception".
|
|
||||||
overgeneral-exceptions=BaseException,
|
|
||||||
Exception
|
|
||||||
12
.vscode/launch.json
vendored
12
.vscode/launch.json
vendored
@@ -1,12 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2.0",
|
|
||||||
"configurations": [
|
|
||||||
{
|
|
||||||
"name": "Python: Launch Frigate",
|
|
||||||
"type": "python",
|
|
||||||
"request": "launch",
|
|
||||||
"module": "frigate",
|
|
||||||
"justMyCode": true
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
# Community-supported boards
|
|
||||||
/docker/tensorrt/ @madsciencetist @NateMeyer
|
|
||||||
/docker/tensorrt/*arm64* @madsciencetist
|
|
||||||
/docker/tensorrt/*jetson* @madsciencetist
|
|
||||||
/docker/rockchip/ @MarcA711
|
|
||||||
/docker/rocm/ @harakas
|
|
||||||
59
Dockerfile
Executable file
59
Dockerfile
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
FROM ubuntu:18.04
|
||||||
|
LABEL maintainer "blakeb@blakeshome.com"
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
# Install packages for apt repo
|
||||||
|
RUN apt -qq update && apt -qq install --no-install-recommends -y \
|
||||||
|
software-properties-common \
|
||||||
|
# apt-transport-https ca-certificates \
|
||||||
|
build-essential \
|
||||||
|
gnupg wget unzip \
|
||||||
|
# libcap-dev \
|
||||||
|
&& add-apt-repository ppa:deadsnakes/ppa -y \
|
||||||
|
&& apt -qq install --no-install-recommends -y \
|
||||||
|
python3.7 \
|
||||||
|
python3.7-dev \
|
||||||
|
python3-pip \
|
||||||
|
ffmpeg \
|
||||||
|
# VAAPI drivers for Intel hardware accel
|
||||||
|
libva-drm2 libva2 i965-va-driver vainfo \
|
||||||
|
&& python3.7 -m pip install -U wheel setuptools \
|
||||||
|
&& python3.7 -m pip install -U \
|
||||||
|
opencv-python-headless \
|
||||||
|
# python-prctl \
|
||||||
|
numpy \
|
||||||
|
imutils \
|
||||||
|
scipy \
|
||||||
|
&& python3.7 -m pip install -U \
|
||||||
|
Flask \
|
||||||
|
paho-mqtt \
|
||||||
|
PyYAML \
|
||||||
|
matplotlib \
|
||||||
|
pyarrow \
|
||||||
|
&& echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list \
|
||||||
|
&& wget -q -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - \
|
||||||
|
&& apt -qq update \
|
||||||
|
&& echo "libedgetpu1-max libedgetpu/accepted-eula boolean true" | debconf-set-selections \
|
||||||
|
&& apt -qq install --no-install-recommends -y \
|
||||||
|
libedgetpu1-max \
|
||||||
|
## Tensorflow lite (python 3.7 only)
|
||||||
|
&& wget -q https://dl.google.com/coral/python/tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
|
||||||
|
&& python3.7 -m pip install tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
|
||||||
|
&& rm tflite_runtime-2.1.0.post1-cp37-cp37m-linux_x86_64.whl \
|
||||||
|
&& rm -rf /var/lib/apt/lists/* \
|
||||||
|
&& (apt-get autoremove -y; apt-get autoclean -y)
|
||||||
|
|
||||||
|
# get model and labels
|
||||||
|
RUN wget -q https://github.com/google-coral/edgetpu/raw/master/test_data/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite -O /edgetpu_model.tflite --trust-server-names
|
||||||
|
RUN wget -q https://dl.google.com/coral/canned_models/coco_labels.txt -O /labelmap.txt --trust-server-names
|
||||||
|
RUN wget -q https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip -O /cpu_model.zip && \
|
||||||
|
unzip /cpu_model.zip detect.tflite -d / && \
|
||||||
|
mv /detect.tflite /cpu_model.tflite && \
|
||||||
|
rm /cpu_model.zip
|
||||||
|
|
||||||
|
WORKDIR /opt/frigate/
|
||||||
|
ADD frigate frigate/
|
||||||
|
COPY detect_objects.py .
|
||||||
|
COPY benchmark.py .
|
||||||
|
|
||||||
|
CMD ["python3.7", "-u", "detect_objects.py"]
|
||||||
674
LICENSE
674
LICENSE
@@ -1,21 +1,661 @@
|
|||||||
The MIT License
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright (c) 2020 Blake Blackshear
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Preamble
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
copies or substantial portions of the Software.
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
The licenses for most software and other practical works are designed
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
to take away your freedom to share and change the works. By contrast,
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
share and change all versions of a program--to make sure it remains free
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
software for all its users.
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published
|
||||||
|
by the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|||||||
42
Makefile
42
Makefile
@@ -1,42 +0,0 @@
|
|||||||
default_target: local
|
|
||||||
|
|
||||||
COMMIT_HASH := $(shell git log -1 --pretty=format:"%h"|tail -1)
|
|
||||||
VERSION = 0.14.0
|
|
||||||
IMAGE_REPO ?= ghcr.io/blakeblackshear/frigate
|
|
||||||
GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD)
|
|
||||||
CURRENT_UID := $(shell id -u)
|
|
||||||
CURRENT_GID := $(shell id -g)
|
|
||||||
BOARDS= #Initialized empty
|
|
||||||
|
|
||||||
include docker/*/*.mk
|
|
||||||
|
|
||||||
build-boards: $(BOARDS:%=build-%)
|
|
||||||
|
|
||||||
push-boards: $(BOARDS:%=push-%)
|
|
||||||
|
|
||||||
version:
|
|
||||||
echo 'VERSION = "$(VERSION)-$(COMMIT_HASH)"' > frigate/version.py
|
|
||||||
|
|
||||||
local: version
|
|
||||||
docker buildx build --target=frigate --tag frigate:latest --load --file docker/main/Dockerfile .
|
|
||||||
|
|
||||||
amd64:
|
|
||||||
docker buildx build --platform linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
|
||||||
|
|
||||||
arm64:
|
|
||||||
docker buildx build --platform linux/arm64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
|
||||||
|
|
||||||
build: version amd64 arm64
|
|
||||||
docker buildx build --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):$(VERSION)-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
|
||||||
|
|
||||||
push: push-boards
|
|
||||||
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --target=frigate --tag $(IMAGE_REPO):${GITHUB_REF_NAME}-$(COMMIT_HASH) --file docker/main/Dockerfile .
|
|
||||||
|
|
||||||
run: local
|
|
||||||
docker run --rm --publish=5000:5000 --volume=${PWD}/config:/config frigate:latest
|
|
||||||
|
|
||||||
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 mypy --config-file frigate/mypy.ini frigate
|
|
||||||
|
|
||||||
.PHONY: run_tests
|
|
||||||
151
README.md
151
README.md
@@ -1,50 +1,127 @@
|
|||||||
<p align="center">
|
# Frigate - Realtime Object Detection for IP Cameras
|
||||||
<img align="center" alt="logo" src="docs/static/img/frigate.png">
|
Uses OpenCV and Tensorflow to perform realtime object detection locally for IP cameras. Designed for integration with HomeAssistant or others via MQTT.
|
||||||
</p>
|
|
||||||
|
|
||||||
# Frigate - NVR With Realtime Object Detection for IP Cameras
|
Use of a [Google Coral USB Accelerator](https://coral.withgoogle.com/products/accelerator/) is optional, but highly recommended. On my Intel i7 processor, I can process 2-3 FPS with the CPU. The Coral can process 100+ FPS with very low CPU load.
|
||||||
|
|
||||||
A complete and local NVR designed for [Home Assistant](https://www.home-assistant.io) with AI object detection. Uses OpenCV and Tensorflow to perform realtime object detection locally for IP cameras.
|
|
||||||
|
|
||||||
Use of a [Google Coral Accelerator](https://coral.ai/products/) is optional, but highly recommended. The Coral will outperform even the best CPUs and can process 100+ FPS with very little overhead.
|
|
||||||
|
|
||||||
- Tight integration with Home Assistant via a [custom component](https://github.com/blakeblackshear/frigate-hass-integration)
|
|
||||||
- Designed to minimize resource use and maximize performance by only looking for objects when and where it is necessary
|
|
||||||
- Leverages multiprocessing heavily with an emphasis on realtime over processing every frame
|
- Leverages multiprocessing heavily with an emphasis on realtime over processing every frame
|
||||||
- Uses a very low overhead motion detection to determine where to run object detection
|
- Uses a very low overhead motion detection to determine where to run object detection
|
||||||
- Object detection with TensorFlow runs in separate processes for maximum FPS
|
- Object detection with Tensorflow runs in a separate process
|
||||||
- Communicates over MQTT for easy integration into other systems
|
- Object info is published over MQTT for integration into HomeAssistant as a binary sensor
|
||||||
- Records video with retention settings based on detected objects
|
- An endpoint is available to view an MJPEG stream for debugging, but should not be used continuously
|
||||||
- 24/7 recording
|
|
||||||
- Re-streaming via RTSP to reduce the number of connections to your camera
|
|
||||||
- WebRTC & MSE support for low-latency live view
|
|
||||||
|
|
||||||
## Documentation
|

|
||||||
|
|
||||||
View the documentation at https://docs.frigate.video
|
## Example video (from older version)
|
||||||
|
You see multiple bounding boxes because it draws bounding boxes from all frames in the past 1 second where a person was detected. Not all of the bounding boxes were from the current frame.
|
||||||
|
[](http://www.youtube.com/watch?v=nqHbCtyo4dY "Frigate")
|
||||||
|
|
||||||
## Donations
|
## Getting Started
|
||||||
|
Run the container with
|
||||||
|
```bash
|
||||||
|
docker run --rm \
|
||||||
|
--privileged \
|
||||||
|
--shm-size=512m \ # should work for a 2-3 cameras
|
||||||
|
-v /dev/bus/usb:/dev/bus/usb \
|
||||||
|
-v <path_to_config_dir>:/config:ro \
|
||||||
|
-v /etc/localtime:/etc/localtime:ro \
|
||||||
|
-p 5000:5000 \
|
||||||
|
-e FRIGATE_RTSP_PASSWORD='password' \
|
||||||
|
blakeblackshear/frigate:stable
|
||||||
|
```
|
||||||
|
|
||||||
If you would like to make a donation to support development, please use [Github Sponsors](https://github.com/sponsors/blakeblackshear).
|
Example docker-compose:
|
||||||
|
```yaml
|
||||||
|
frigate:
|
||||||
|
container_name: frigate
|
||||||
|
restart: unless-stopped
|
||||||
|
privileged: true
|
||||||
|
shm_size: '1g' # should work for 5-7 cameras
|
||||||
|
image: blakeblackshear/frigate:stable
|
||||||
|
volumes:
|
||||||
|
- /dev/bus/usb:/dev/bus/usb
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
- <path_to_config>:/config
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
|
environment:
|
||||||
|
FRIGATE_RTSP_PASSWORD: "password"
|
||||||
|
```
|
||||||
|
|
||||||
## Screenshots
|
A `config.yml` file must exist in the `config` directory. See example [here](config/config.example.yml) and device specific info can be found [here](docs/DEVICES.md).
|
||||||
|
|
||||||
### Live dashboard
|
Access the mjpeg stream at `http://localhost:5000/<camera_name>` and the best snapshot for any object type with at `http://localhost:5000/<camera_name>/<object_name>/best.jpg`
|
||||||
<div>
|
|
||||||
<img width="800" alt="Live dashboard" src="https://github.com/blakeblackshear/frigate/assets/569905/5e713cb9-9db5-41dc-947a-6937c3bc376e">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
### Streamlined review workflow
|
Debug info is available at `http://localhost:5000/debug/stats`
|
||||||
<div>
|
|
||||||
<img width="800" alt="Streamlined review workflow" src="https://github.com/blakeblackshear/frigate/assets/569905/6fed96e8-3b18-40e5-9ddc-31e6f3c9f2ff">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
### Multi-camera scrubbing
|
## Integration with HomeAssistant
|
||||||
<div>
|
```
|
||||||
<img width="800" alt="Multi-camera scrubbing" src="https://github.com/blakeblackshear/frigate/assets/569905/d6788a15-0eeb-4427-a8d4-80b93cae3d74">
|
camera:
|
||||||
</div>
|
- name: Camera Last Person
|
||||||
|
platform: mqtt
|
||||||
|
topic: frigate/<camera_name>/person/snapshot
|
||||||
|
- name: Camera Last Car
|
||||||
|
platform: mqtt
|
||||||
|
topic: frigate/<camera_name>/car/snapshot
|
||||||
|
|
||||||
### Built-in mask and zone editor
|
binary_sensor:
|
||||||
<div>
|
- name: Camera Person
|
||||||
<img width="800" alt="Multi-camera scrubbing" src="https://github.com/blakeblackshear/frigate/assets/569905/d7885fc3-bfe6-452f-b7d0-d957cb3e31f5">
|
platform: mqtt
|
||||||
</div>
|
state_topic: "frigate/<camera_name>/person"
|
||||||
|
device_class: motion
|
||||||
|
availability_topic: "frigate/available"
|
||||||
|
|
||||||
|
automation:
|
||||||
|
- alias: Alert me if a person is detected while armed away
|
||||||
|
trigger:
|
||||||
|
platform: state
|
||||||
|
entity_id: binary_sensor.camera_person
|
||||||
|
from: 'off'
|
||||||
|
to: 'on'
|
||||||
|
condition:
|
||||||
|
- condition: state
|
||||||
|
entity_id: alarm_control_panel.home_alarm
|
||||||
|
state: armed_away
|
||||||
|
action:
|
||||||
|
- service: notify.user_telegram
|
||||||
|
data:
|
||||||
|
message: "A person was detected."
|
||||||
|
data:
|
||||||
|
photo:
|
||||||
|
- url: http://<ip>:5000/<camera_name>/person/best.jpg
|
||||||
|
caption: A person was detected.
|
||||||
|
|
||||||
|
sensor:
|
||||||
|
- platform: rest
|
||||||
|
name: Frigate Debug
|
||||||
|
resource: http://localhost:5000/debug/stats
|
||||||
|
scan_interval: 5
|
||||||
|
json_attributes:
|
||||||
|
- back
|
||||||
|
- coral
|
||||||
|
value_template: 'OK'
|
||||||
|
- platform: template
|
||||||
|
sensors:
|
||||||
|
back_fps:
|
||||||
|
value_template: '{{ states.sensor.frigate_debug.attributes["back"]["fps"] }}'
|
||||||
|
unit_of_measurement: 'FPS'
|
||||||
|
back_skipped_fps:
|
||||||
|
value_template: '{{ states.sensor.frigate_debug.attributes["back"]["skipped_fps"] }}'
|
||||||
|
unit_of_measurement: 'FPS'
|
||||||
|
back_detection_fps:
|
||||||
|
value_template: '{{ states.sensor.frigate_debug.attributes["back"]["detection_fps"] }}'
|
||||||
|
unit_of_measurement: 'FPS'
|
||||||
|
frigate_coral_fps:
|
||||||
|
value_template: '{{ states.sensor.frigate_debug.attributes["coral"]["fps"] }}'
|
||||||
|
unit_of_measurement: 'FPS'
|
||||||
|
frigate_coral_inference:
|
||||||
|
value_template: '{{ states.sensor.frigate_debug.attributes["coral"]["inference_speed"] }}'
|
||||||
|
unit_of_measurement: 'ms'
|
||||||
|
```
|
||||||
|
## Using a custom model
|
||||||
|
Models for both CPU and EdgeTPU (Coral) are bundled in the image. You can use your own models with volume mounts:
|
||||||
|
- CPU Model: `/cpu_model.tflite`
|
||||||
|
- EdgeTPU Model: `/edgetpu_model.tflite`
|
||||||
|
- Labels: `/labelmap.txt`
|
||||||
|
|
||||||
|
## Tips
|
||||||
|
- Lower the framerate of the video feed on the camera to reduce the CPU usage for capturing the feed
|
||||||
|
|||||||
@@ -1,521 +0,0 @@
|
|||||||
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
|
|
||||||
91
benchmark.py
91
benchmark.py
@@ -1,23 +1,17 @@
|
|||||||
import datetime
|
import os
|
||||||
import multiprocessing as mp
|
|
||||||
from statistics import mean
|
from statistics import mean
|
||||||
|
import multiprocessing as mp
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import datetime
|
||||||
|
from frigate.edgetpu import ObjectDetector, EdgeTPUProcess, RemoteObjectDetector, load_labels
|
||||||
|
|
||||||
from frigate.config import DetectorTypeEnum
|
my_frame = np.expand_dims(np.full((300,300,3), 1, np.uint8), axis=0)
|
||||||
from frigate.object_detection import (
|
labels = load_labels('/labelmap.txt')
|
||||||
ObjectDetectProcess,
|
|
||||||
RemoteObjectDetector,
|
|
||||||
load_labels,
|
|
||||||
)
|
|
||||||
|
|
||||||
my_frame = np.expand_dims(np.full((300, 300, 3), 1, np.uint8), axis=0)
|
|
||||||
labels = load_labels("/labelmap.txt")
|
|
||||||
|
|
||||||
######
|
######
|
||||||
# Minimal same process runner
|
# Minimal same process runner
|
||||||
######
|
######
|
||||||
# object_detector = LocalObjectDetector()
|
# object_detector = ObjectDetector()
|
||||||
# tensor_input = np.expand_dims(np.full((300,300,3), 0, np.uint8), axis=0)
|
# tensor_input = np.expand_dims(np.full((300,300,3), 0, np.uint8), axis=0)
|
||||||
|
|
||||||
# start = datetime.datetime.now().timestamp()
|
# start = datetime.datetime.now().timestamp()
|
||||||
@@ -43,66 +37,43 @@ labels = load_labels("/labelmap.txt")
|
|||||||
# print(f"Processed for {duration:.2f} seconds.")
|
# print(f"Processed for {duration:.2f} seconds.")
|
||||||
# print(f"Average frame processing time: {mean(frame_times)*1000:.2f}ms")
|
# print(f"Average frame processing time: {mean(frame_times)*1000:.2f}ms")
|
||||||
|
|
||||||
|
|
||||||
def start(id, num_detections, detection_queue, event):
|
|
||||||
object_detector = RemoteObjectDetector(
|
|
||||||
str(id), "/labelmap.txt", detection_queue, event
|
|
||||||
)
|
|
||||||
start = datetime.datetime.now().timestamp()
|
|
||||||
|
|
||||||
frame_times = []
|
|
||||||
for x in range(0, num_detections):
|
|
||||||
start_frame = datetime.datetime.now().timestamp()
|
|
||||||
object_detector.detect(my_frame)
|
|
||||||
frame_times.append(datetime.datetime.now().timestamp() - start_frame)
|
|
||||||
|
|
||||||
duration = datetime.datetime.now().timestamp() - start
|
|
||||||
object_detector.cleanup()
|
|
||||||
print(f"{id} - Processed for {duration:.2f} seconds.")
|
|
||||||
print(f"{id} - FPS: {object_detector.fps.eps():.2f}")
|
|
||||||
print(f"{id} - Average frame processing time: {mean(frame_times)*1000:.2f}ms")
|
|
||||||
|
|
||||||
|
|
||||||
######
|
######
|
||||||
# Separate process runner
|
# Separate process runner
|
||||||
######
|
######
|
||||||
# event = mp.Event()
|
def start(id, num_detections, detection_queue):
|
||||||
# detection_queue = mp.Queue()
|
object_detector = RemoteObjectDetector(str(id), '/labelmap.txt', detection_queue)
|
||||||
# edgetpu_process = EdgeTPUProcess(detection_queue, {'1': event}, 'usb:0')
|
start = datetime.datetime.now().timestamp()
|
||||||
|
|
||||||
# start(1, 1000, edgetpu_process.detection_queue, event)
|
frame_times = []
|
||||||
# print(f"Average raw inference speed: {edgetpu_process.avg_inference_speed.value*1000:.2f}ms")
|
for x in range(0, num_detections):
|
||||||
|
start_frame = datetime.datetime.now().timestamp()
|
||||||
|
detections = object_detector.detect(my_frame)
|
||||||
|
frame_times.append(datetime.datetime.now().timestamp()-start_frame)
|
||||||
|
|
||||||
|
duration = datetime.datetime.now().timestamp()-start
|
||||||
|
print(f"{id} - Processed for {duration:.2f} seconds.")
|
||||||
|
print(f"{id} - Average frame processing time: {mean(frame_times)*1000:.2f}ms")
|
||||||
|
|
||||||
|
edgetpu_process = EdgeTPUProcess()
|
||||||
|
|
||||||
|
# start(1, 1000, edgetpu_process.detect_lock, edgetpu_process.detect_ready, edgetpu_process.frame_ready)
|
||||||
|
|
||||||
####
|
####
|
||||||
# Multiple camera processes
|
# Multiple camera processes
|
||||||
####
|
####
|
||||||
camera_processes = []
|
camera_processes = []
|
||||||
|
|
||||||
events = {}
|
|
||||||
for x in range(0, 10):
|
for x in range(0, 10):
|
||||||
events[str(x)] = mp.Event()
|
camera_process = mp.Process(target=start, args=(x, 100, edgetpu_process.detection_queue))
|
||||||
detection_queue = mp.Queue()
|
camera_process.daemon = True
|
||||||
edgetpu_process_1 = ObjectDetectProcess(
|
camera_processes.append(camera_process)
|
||||||
detection_queue, events, DetectorTypeEnum.edgetpu, "usb:0"
|
|
||||||
)
|
|
||||||
edgetpu_process_2 = ObjectDetectProcess(
|
|
||||||
detection_queue, events, DetectorTypeEnum.edgetpu, "usb:1"
|
|
||||||
)
|
|
||||||
|
|
||||||
for x in range(0, 10):
|
start = datetime.datetime.now().timestamp()
|
||||||
camera_process = mp.Process(
|
|
||||||
target=start, args=(x, 300, detection_queue, events[str(x)])
|
|
||||||
)
|
|
||||||
camera_process.daemon = True
|
|
||||||
camera_processes.append(camera_process)
|
|
||||||
|
|
||||||
start_time = datetime.datetime.now().timestamp()
|
|
||||||
|
|
||||||
for p in camera_processes:
|
for p in camera_processes:
|
||||||
p.start()
|
p.start()
|
||||||
|
|
||||||
for p in camera_processes:
|
for p in camera_processes:
|
||||||
p.join()
|
p.join()
|
||||||
|
|
||||||
duration = datetime.datetime.now().timestamp() - start_time
|
duration = datetime.datetime.now().timestamp()-start
|
||||||
print(f"Total - Processed for {duration:.2f} seconds.")
|
print(f"Total - Processed for {duration:.2f} seconds.")
|
||||||
@@ -1,118 +0,0 @@
|
|||||||
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()
|
|
||||||
BIN
config/back-mask.bmp
Normal file
BIN
config/back-mask.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.8 MiB |
129
config/config.example.yml
Normal file
129
config/config.example.yml
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
web_port: 5000
|
||||||
|
|
||||||
|
mqtt:
|
||||||
|
host: mqtt.server.com
|
||||||
|
topic_prefix: frigate
|
||||||
|
# client_id: frigate # Optional -- set to override default client id of 'frigate' if running multiple instances
|
||||||
|
# user: username # Optional
|
||||||
|
#################
|
||||||
|
## Environment variables that begin with 'FRIGATE_' may be referenced in {}.
|
||||||
|
## password: '{FRIGATE_MQTT_PASSWORD}'
|
||||||
|
#################
|
||||||
|
# password: password # Optional
|
||||||
|
|
||||||
|
#################
|
||||||
|
# Default ffmpeg args. Optional and can be overwritten per camera.
|
||||||
|
# Should work with most RTSP cameras that send h264 video
|
||||||
|
# Built from the properties below with:
|
||||||
|
# "ffmpeg" + global_args + input_args + "-i" + input + output_args
|
||||||
|
#################
|
||||||
|
# ffmpeg:
|
||||||
|
# global_args:
|
||||||
|
# - -hide_banner
|
||||||
|
# - -loglevel
|
||||||
|
# - panic
|
||||||
|
# hwaccel_args: []
|
||||||
|
# input_args:
|
||||||
|
# - -avoid_negative_ts
|
||||||
|
# - make_zero
|
||||||
|
# - -fflags
|
||||||
|
# - nobuffer
|
||||||
|
# - -flags
|
||||||
|
# - low_delay
|
||||||
|
# - -strict
|
||||||
|
# - experimental
|
||||||
|
# - -fflags
|
||||||
|
# - +genpts+discardcorrupt
|
||||||
|
# - -vsync
|
||||||
|
# - drop
|
||||||
|
# - -rtsp_transport
|
||||||
|
# - tcp
|
||||||
|
# - -stimeout
|
||||||
|
# - '5000000'
|
||||||
|
# - -use_wallclock_as_timestamps
|
||||||
|
# - '1'
|
||||||
|
# output_args:
|
||||||
|
# - -f
|
||||||
|
# - rawvideo
|
||||||
|
# - -pix_fmt
|
||||||
|
# - rgb24
|
||||||
|
|
||||||
|
####################
|
||||||
|
# Global object configuration. Applies to all cameras
|
||||||
|
# unless overridden at the camera levels.
|
||||||
|
# Keys must be valid labels. By default, the model uses coco (https://dl.google.com/coral/canned_models/coco_labels.txt).
|
||||||
|
# All labels from the model are reported over MQTT. These values are used to filter out false positives.
|
||||||
|
# min_area (optional): minimum width*height of the bounding box for the detected person
|
||||||
|
# max_area (optional): maximum width*height of the bounding box for the detected person
|
||||||
|
# threshold (optional): The minimum decimal percentage (50% hit = 0.5) for the confidence from tensorflow
|
||||||
|
####################
|
||||||
|
objects:
|
||||||
|
track:
|
||||||
|
- person
|
||||||
|
- car
|
||||||
|
- truck
|
||||||
|
filters:
|
||||||
|
person:
|
||||||
|
min_area: 5000
|
||||||
|
max_area: 100000
|
||||||
|
threshold: 0.5
|
||||||
|
|
||||||
|
cameras:
|
||||||
|
back:
|
||||||
|
ffmpeg:
|
||||||
|
################
|
||||||
|
# Source passed to ffmpeg after the -i parameter. Supports anything compatible with OpenCV and FFmpeg.
|
||||||
|
# Environment variables that begin with 'FRIGATE_' may be referenced in {}
|
||||||
|
################
|
||||||
|
input: rtsp://viewer:{FRIGATE_RTSP_PASSWORD}@10.0.10.10:554/cam/realmonitor?channel=1&subtype=2
|
||||||
|
#################
|
||||||
|
# These values will override default values for just this camera
|
||||||
|
#################
|
||||||
|
# global_args: []
|
||||||
|
# hwaccel_args: []
|
||||||
|
# input_args: []
|
||||||
|
# output_args: []
|
||||||
|
|
||||||
|
################
|
||||||
|
## Optionally specify the resolution of the video feed. Frigate will try to auto detect if not specified
|
||||||
|
################
|
||||||
|
# height: 1280
|
||||||
|
# width: 720
|
||||||
|
|
||||||
|
################
|
||||||
|
## Optional mask. Must be the same aspect ratio as your video feed.
|
||||||
|
##
|
||||||
|
## The mask works by looking at the bottom center of the bounding box for the detected
|
||||||
|
## person in the image. If that pixel in the mask is a black pixel, it ignores it as a
|
||||||
|
## false positive. In my mask, the grass and driveway visible from my backdoor camera
|
||||||
|
## are white. The garage doors, sky, and trees (anywhere it would be impossible for a
|
||||||
|
## person to stand) are black.
|
||||||
|
##
|
||||||
|
## Masked areas are also ignored for motion detection.
|
||||||
|
################
|
||||||
|
# mask: back-mask.bmp
|
||||||
|
|
||||||
|
################
|
||||||
|
# Allows you to limit the framerate within frigate for cameras that do not support
|
||||||
|
# custom framerates. A value of 1 tells frigate to look at every frame, 2 every 2nd frame,
|
||||||
|
# 3 every 3rd frame, etc.
|
||||||
|
################
|
||||||
|
take_frame: 1
|
||||||
|
|
||||||
|
################
|
||||||
|
# Configuration for the snapshots in the debug view and mqtt
|
||||||
|
################
|
||||||
|
snapshots:
|
||||||
|
show_timestamp: True
|
||||||
|
|
||||||
|
################
|
||||||
|
# Camera level object config. This config is merged with the global config above.
|
||||||
|
################
|
||||||
|
objects:
|
||||||
|
track:
|
||||||
|
- person
|
||||||
|
filters:
|
||||||
|
person:
|
||||||
|
min_area: 5000
|
||||||
|
max_area: 100000
|
||||||
|
threshold: 0.5
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
mqtt:
|
|
||||||
host: mqtt
|
|
||||||
|
|
||||||
cameras:
|
|
||||||
test:
|
|
||||||
ffmpeg:
|
|
||||||
inputs:
|
|
||||||
- path: /media/frigate/car-stopping.mp4
|
|
||||||
input_args: -re -stream_loop -1 -fflags +genpts
|
|
||||||
roles:
|
|
||||||
- detect
|
|
||||||
- rtmp
|
|
||||||
detect:
|
|
||||||
height: 1080
|
|
||||||
width: 1920
|
|
||||||
fps: 5
|
|
||||||
21
cspell.json
21
cspell.json
@@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"version": "0.2",
|
|
||||||
"ignorePaths": [
|
|
||||||
"Dockerfile",
|
|
||||||
"Dockerfile.*",
|
|
||||||
"CMakeLists.txt",
|
|
||||||
"*.db",
|
|
||||||
"node_modules",
|
|
||||||
"__pycache__",
|
|
||||||
"dist"
|
|
||||||
],
|
|
||||||
"language": "en",
|
|
||||||
"dictionaryDefinitions": [
|
|
||||||
{
|
|
||||||
"name": "frigate-dictionary",
|
|
||||||
"path": "./.cspell/frigate-dictionary.txt",
|
|
||||||
"addWords": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"dictionaries": ["frigate-dictionary"]
|
|
||||||
}
|
|
||||||
348
detect_objects.py
Normal file
348
detect_objects.py
Normal file
@@ -0,0 +1,348 @@
|
|||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import traceback
|
||||||
|
import signal
|
||||||
|
import cv2
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
|
import queue
|
||||||
|
import yaml
|
||||||
|
import threading
|
||||||
|
import multiprocessing as mp
|
||||||
|
import subprocess as sp
|
||||||
|
import numpy as np
|
||||||
|
import logging
|
||||||
|
from flask import Flask, Response, make_response, jsonify, request
|
||||||
|
import paho.mqtt.client as mqtt
|
||||||
|
|
||||||
|
from frigate.video import track_camera, get_ffmpeg_input, get_frame_shape, CameraCapture, start_or_restart_ffmpeg
|
||||||
|
from frigate.object_processing import TrackedObjectProcessor
|
||||||
|
from frigate.util import EventsPerSecond
|
||||||
|
from frigate.edgetpu import EdgeTPUProcess
|
||||||
|
|
||||||
|
FRIGATE_VARS = {k: v for k, v in os.environ.items() if k.startswith('FRIGATE_')}
|
||||||
|
|
||||||
|
with open('/config/config.yml') as f:
|
||||||
|
CONFIG = yaml.safe_load(f)
|
||||||
|
|
||||||
|
MQTT_HOST = CONFIG['mqtt']['host']
|
||||||
|
MQTT_PORT = CONFIG.get('mqtt', {}).get('port', 1883)
|
||||||
|
MQTT_TOPIC_PREFIX = CONFIG.get('mqtt', {}).get('topic_prefix', 'frigate')
|
||||||
|
MQTT_USER = CONFIG.get('mqtt', {}).get('user')
|
||||||
|
MQTT_PASS = CONFIG.get('mqtt', {}).get('password')
|
||||||
|
if not MQTT_PASS is None:
|
||||||
|
MQTT_PASS = MQTT_PASS.format(**FRIGATE_VARS)
|
||||||
|
MQTT_CLIENT_ID = CONFIG.get('mqtt', {}).get('client_id', 'frigate')
|
||||||
|
|
||||||
|
# Set the default FFmpeg config
|
||||||
|
FFMPEG_CONFIG = CONFIG.get('ffmpeg', {})
|
||||||
|
FFMPEG_DEFAULT_CONFIG = {
|
||||||
|
'global_args': FFMPEG_CONFIG.get('global_args',
|
||||||
|
['-hide_banner','-loglevel','panic']),
|
||||||
|
'hwaccel_args': FFMPEG_CONFIG.get('hwaccel_args',
|
||||||
|
[]),
|
||||||
|
'input_args': FFMPEG_CONFIG.get('input_args',
|
||||||
|
['-avoid_negative_ts', 'make_zero',
|
||||||
|
'-fflags', 'nobuffer',
|
||||||
|
'-flags', 'low_delay',
|
||||||
|
'-strict', 'experimental',
|
||||||
|
'-fflags', '+genpts+discardcorrupt',
|
||||||
|
'-vsync', 'drop',
|
||||||
|
'-rtsp_transport', 'tcp',
|
||||||
|
'-stimeout', '5000000',
|
||||||
|
'-use_wallclock_as_timestamps', '1']),
|
||||||
|
'output_args': FFMPEG_CONFIG.get('output_args',
|
||||||
|
['-f', 'rawvideo',
|
||||||
|
'-pix_fmt', 'rgb24'])
|
||||||
|
}
|
||||||
|
|
||||||
|
GLOBAL_OBJECT_CONFIG = CONFIG.get('objects', {})
|
||||||
|
|
||||||
|
WEB_PORT = CONFIG.get('web_port', 5000)
|
||||||
|
DEBUG = (CONFIG.get('debug', '0') == '1')
|
||||||
|
|
||||||
|
def start_plasma_store():
|
||||||
|
plasma_cmd = ['plasma_store', '-m', '400000000', '-s', '/tmp/plasma']
|
||||||
|
plasma_process = sp.Popen(plasma_cmd, stdout=sp.DEVNULL, stderr=sp.DEVNULL)
|
||||||
|
time.sleep(1)
|
||||||
|
rc = plasma_process.poll()
|
||||||
|
if rc is not None:
|
||||||
|
return None
|
||||||
|
return plasma_process
|
||||||
|
|
||||||
|
class CameraWatchdog(threading.Thread):
|
||||||
|
def __init__(self, camera_processes, config, tflite_process, tracked_objects_queue, plasma_process):
|
||||||
|
threading.Thread.__init__(self)
|
||||||
|
self.camera_processes = camera_processes
|
||||||
|
self.config = config
|
||||||
|
self.tflite_process = tflite_process
|
||||||
|
self.tracked_objects_queue = tracked_objects_queue
|
||||||
|
self.plasma_process = plasma_process
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
time.sleep(10)
|
||||||
|
while True:
|
||||||
|
# wait a bit before checking
|
||||||
|
time.sleep(10)
|
||||||
|
|
||||||
|
# check the plasma process
|
||||||
|
rc = self.plasma_process.poll()
|
||||||
|
if rc != None:
|
||||||
|
print(f"plasma_process exited unexpectedly with {rc}")
|
||||||
|
self.plasma_process = start_plasma_store()
|
||||||
|
|
||||||
|
# check the detection process
|
||||||
|
detection_start = self.tflite_process.detection_start.value
|
||||||
|
if (detection_start > 0.0 and
|
||||||
|
datetime.datetime.now().timestamp() - detection_start > 10):
|
||||||
|
print("Detection appears to be stuck. Restarting detection process")
|
||||||
|
self.tflite_process.start_or_restart()
|
||||||
|
elif not self.tflite_process.detect_process.is_alive():
|
||||||
|
print("Detection appears to have stopped. Restarting detection process")
|
||||||
|
self.tflite_process.start_or_restart()
|
||||||
|
|
||||||
|
# check the camera processes
|
||||||
|
for name, camera_process in self.camera_processes.items():
|
||||||
|
process = camera_process['process']
|
||||||
|
if not process.is_alive():
|
||||||
|
print(f"Track process for {name} is not alive. Starting again...")
|
||||||
|
camera_process['process_fps'].value = 0.0
|
||||||
|
camera_process['detection_fps'].value = 0.0
|
||||||
|
camera_process['read_start'].value = 0.0
|
||||||
|
process = mp.Process(target=track_camera, args=(name, self.config[name], GLOBAL_OBJECT_CONFIG, camera_process['frame_queue'],
|
||||||
|
camera_process['frame_shape'], self.tflite_process.detection_queue, self.tracked_objects_queue,
|
||||||
|
camera_process['process_fps'], camera_process['detection_fps'],
|
||||||
|
camera_process['read_start'], camera_process['detection_frame']))
|
||||||
|
process.daemon = True
|
||||||
|
camera_process['process'] = process
|
||||||
|
process.start()
|
||||||
|
print(f"Track process started for {name}: {process.pid}")
|
||||||
|
|
||||||
|
if not camera_process['capture_thread'].is_alive():
|
||||||
|
frame_shape = camera_process['frame_shape']
|
||||||
|
frame_size = frame_shape[0] * frame_shape[1] * frame_shape[2]
|
||||||
|
ffmpeg_process = start_or_restart_ffmpeg(camera_process['ffmpeg_cmd'], frame_size)
|
||||||
|
camera_capture = CameraCapture(name, ffmpeg_process, frame_shape, camera_process['frame_queue'],
|
||||||
|
camera_process['take_frame'], camera_process['camera_fps'], camera_process['detection_frame'])
|
||||||
|
camera_capture.start()
|
||||||
|
camera_process['ffmpeg_process'] = ffmpeg_process
|
||||||
|
camera_process['capture_thread'] = camera_capture
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# connect to mqtt and setup last will
|
||||||
|
def on_connect(client, userdata, flags, rc):
|
||||||
|
print("On connect called")
|
||||||
|
if rc != 0:
|
||||||
|
if rc == 3:
|
||||||
|
print ("MQTT Server unavailable")
|
||||||
|
elif rc == 4:
|
||||||
|
print ("MQTT Bad username or password")
|
||||||
|
elif rc == 5:
|
||||||
|
print ("MQTT Not authorized")
|
||||||
|
else:
|
||||||
|
print ("Unable to connect to MQTT: Connection refused. Error code: " + str(rc))
|
||||||
|
# publish a message to signal that the service is running
|
||||||
|
client.publish(MQTT_TOPIC_PREFIX+'/available', 'online', retain=True)
|
||||||
|
client = mqtt.Client(client_id=MQTT_CLIENT_ID)
|
||||||
|
client.on_connect = on_connect
|
||||||
|
client.will_set(MQTT_TOPIC_PREFIX+'/available', payload='offline', qos=1, retain=True)
|
||||||
|
if not MQTT_USER is None:
|
||||||
|
client.username_pw_set(MQTT_USER, password=MQTT_PASS)
|
||||||
|
client.connect(MQTT_HOST, MQTT_PORT, 60)
|
||||||
|
client.loop_start()
|
||||||
|
|
||||||
|
plasma_process = start_plasma_store()
|
||||||
|
|
||||||
|
##
|
||||||
|
# Setup config defaults for cameras
|
||||||
|
##
|
||||||
|
for name, config in CONFIG['cameras'].items():
|
||||||
|
config['snapshots'] = {
|
||||||
|
'show_timestamp': config.get('snapshots', {}).get('show_timestamp', True)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Queue for cameras to push tracked objects to
|
||||||
|
tracked_objects_queue = mp.SimpleQueue()
|
||||||
|
|
||||||
|
# Start the shared tflite process
|
||||||
|
tflite_process = EdgeTPUProcess()
|
||||||
|
|
||||||
|
# start the camera processes
|
||||||
|
camera_processes = {}
|
||||||
|
for name, config in CONFIG['cameras'].items():
|
||||||
|
# Merge the ffmpeg config with the global config
|
||||||
|
ffmpeg = config.get('ffmpeg', {})
|
||||||
|
ffmpeg_input = get_ffmpeg_input(ffmpeg['input'])
|
||||||
|
ffmpeg_global_args = ffmpeg.get('global_args', FFMPEG_DEFAULT_CONFIG['global_args'])
|
||||||
|
ffmpeg_hwaccel_args = ffmpeg.get('hwaccel_args', FFMPEG_DEFAULT_CONFIG['hwaccel_args'])
|
||||||
|
ffmpeg_input_args = ffmpeg.get('input_args', FFMPEG_DEFAULT_CONFIG['input_args'])
|
||||||
|
ffmpeg_output_args = ffmpeg.get('output_args', FFMPEG_DEFAULT_CONFIG['output_args'])
|
||||||
|
ffmpeg_cmd = (['ffmpeg'] +
|
||||||
|
ffmpeg_global_args +
|
||||||
|
ffmpeg_hwaccel_args +
|
||||||
|
ffmpeg_input_args +
|
||||||
|
['-i', ffmpeg_input] +
|
||||||
|
ffmpeg_output_args +
|
||||||
|
['pipe:'])
|
||||||
|
|
||||||
|
if 'width' in config and 'height' in config:
|
||||||
|
frame_shape = (config['height'], config['width'], 3)
|
||||||
|
else:
|
||||||
|
frame_shape = get_frame_shape(ffmpeg_input)
|
||||||
|
|
||||||
|
frame_size = frame_shape[0] * frame_shape[1] * frame_shape[2]
|
||||||
|
take_frame = config.get('take_frame', 1)
|
||||||
|
|
||||||
|
detection_frame = mp.Value('d', 0.0)
|
||||||
|
|
||||||
|
ffmpeg_process = start_or_restart_ffmpeg(ffmpeg_cmd, frame_size)
|
||||||
|
frame_queue = mp.SimpleQueue()
|
||||||
|
camera_fps = EventsPerSecond()
|
||||||
|
camera_fps.start()
|
||||||
|
camera_capture = CameraCapture(name, ffmpeg_process, frame_shape, frame_queue, take_frame, camera_fps, detection_frame)
|
||||||
|
camera_capture.start()
|
||||||
|
|
||||||
|
camera_processes[name] = {
|
||||||
|
'camera_fps': camera_fps,
|
||||||
|
'take_frame': take_frame,
|
||||||
|
'process_fps': mp.Value('d', 0.0),
|
||||||
|
'detection_fps': mp.Value('d', 0.0),
|
||||||
|
'detection_frame': detection_frame,
|
||||||
|
'read_start': mp.Value('d', 0.0),
|
||||||
|
'ffmpeg_process': ffmpeg_process,
|
||||||
|
'ffmpeg_cmd': ffmpeg_cmd,
|
||||||
|
'frame_queue': frame_queue,
|
||||||
|
'frame_shape': frame_shape,
|
||||||
|
'capture_thread': camera_capture
|
||||||
|
}
|
||||||
|
|
||||||
|
camera_process = mp.Process(target=track_camera, args=(name, config, GLOBAL_OBJECT_CONFIG, frame_queue, frame_shape,
|
||||||
|
tflite_process.detection_queue, tracked_objects_queue, camera_processes[name]['process_fps'],
|
||||||
|
camera_processes[name]['detection_fps'],
|
||||||
|
camera_processes[name]['read_start'], camera_processes[name]['detection_frame']))
|
||||||
|
camera_process.daemon = True
|
||||||
|
camera_processes[name]['process'] = camera_process
|
||||||
|
|
||||||
|
for name, camera_process in camera_processes.items():
|
||||||
|
camera_process['process'].start()
|
||||||
|
print(f"Camera_process started for {name}: {camera_process['process'].pid}")
|
||||||
|
|
||||||
|
object_processor = TrackedObjectProcessor(CONFIG['cameras'], client, MQTT_TOPIC_PREFIX, tracked_objects_queue)
|
||||||
|
object_processor.start()
|
||||||
|
|
||||||
|
camera_watchdog = CameraWatchdog(camera_processes, CONFIG['cameras'], tflite_process, tracked_objects_queue, plasma_process)
|
||||||
|
camera_watchdog.start()
|
||||||
|
|
||||||
|
# create a flask app that encodes frames a mjpeg on demand
|
||||||
|
app = Flask(__name__)
|
||||||
|
log = logging.getLogger('werkzeug')
|
||||||
|
log.setLevel(logging.ERROR)
|
||||||
|
|
||||||
|
@app.route('/')
|
||||||
|
def ishealthy():
|
||||||
|
# return a healh
|
||||||
|
return "Frigate is running. Alive and healthy!"
|
||||||
|
|
||||||
|
@app.route('/debug/stack')
|
||||||
|
def processor_stack():
|
||||||
|
frame = sys._current_frames().get(object_processor.ident, None)
|
||||||
|
if frame:
|
||||||
|
return "<br>".join(traceback.format_stack(frame)), 200
|
||||||
|
else:
|
||||||
|
return "no frame found", 200
|
||||||
|
|
||||||
|
@app.route('/debug/print_stack')
|
||||||
|
def print_stack():
|
||||||
|
pid = int(request.args.get('pid', 0))
|
||||||
|
if pid == 0:
|
||||||
|
return "missing pid", 200
|
||||||
|
else:
|
||||||
|
os.kill(pid, signal.SIGUSR1)
|
||||||
|
return "check logs", 200
|
||||||
|
|
||||||
|
@app.route('/debug/stats')
|
||||||
|
def stats():
|
||||||
|
stats = {}
|
||||||
|
|
||||||
|
total_detection_fps = 0
|
||||||
|
|
||||||
|
for name, camera_stats in camera_processes.items():
|
||||||
|
total_detection_fps += camera_stats['detection_fps'].value
|
||||||
|
capture_thread = camera_stats['capture_thread']
|
||||||
|
stats[name] = {
|
||||||
|
'camera_fps': round(capture_thread.fps.eps(), 2),
|
||||||
|
'process_fps': round(camera_stats['process_fps'].value, 2),
|
||||||
|
'skipped_fps': round(capture_thread.skipped_fps.eps(), 2),
|
||||||
|
'detection_fps': round(camera_stats['detection_fps'].value, 2),
|
||||||
|
'read_start': camera_stats['read_start'].value,
|
||||||
|
'pid': camera_stats['process'].pid,
|
||||||
|
'ffmpeg_pid': camera_stats['ffmpeg_process'].pid,
|
||||||
|
'frame_info': {
|
||||||
|
'read': capture_thread.current_frame,
|
||||||
|
'detect': camera_stats['detection_frame'].value,
|
||||||
|
'process': object_processor.camera_data[name]['current_frame_time']
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stats['coral'] = {
|
||||||
|
'fps': round(total_detection_fps, 2),
|
||||||
|
'inference_speed': round(tflite_process.avg_inference_speed.value*1000, 2),
|
||||||
|
'detection_start': tflite_process.detection_start.value,
|
||||||
|
'pid': tflite_process.detect_process.pid
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = camera_watchdog.plasma_process.poll()
|
||||||
|
stats['plasma_store_rc'] = rc
|
||||||
|
|
||||||
|
return jsonify(stats)
|
||||||
|
|
||||||
|
@app.route('/<camera_name>/<label>/best.jpg')
|
||||||
|
def best(camera_name, label):
|
||||||
|
if camera_name in CONFIG['cameras']:
|
||||||
|
best_frame = object_processor.get_best(camera_name, label)
|
||||||
|
if best_frame is None:
|
||||||
|
best_frame = np.zeros((720,1280,3), np.uint8)
|
||||||
|
best_frame = cv2.cvtColor(best_frame, cv2.COLOR_RGB2BGR)
|
||||||
|
ret, jpg = cv2.imencode('.jpg', best_frame)
|
||||||
|
response = make_response(jpg.tobytes())
|
||||||
|
response.headers['Content-Type'] = 'image/jpg'
|
||||||
|
return response
|
||||||
|
else:
|
||||||
|
return "Camera named {} not found".format(camera_name), 404
|
||||||
|
|
||||||
|
@app.route('/<camera_name>')
|
||||||
|
def mjpeg_feed(camera_name):
|
||||||
|
fps = int(request.args.get('fps', '3'))
|
||||||
|
height = int(request.args.get('h', '360'))
|
||||||
|
if camera_name in CONFIG['cameras']:
|
||||||
|
# return a multipart response
|
||||||
|
return Response(imagestream(camera_name, fps, height),
|
||||||
|
mimetype='multipart/x-mixed-replace; boundary=frame')
|
||||||
|
else:
|
||||||
|
return "Camera named {} not found".format(camera_name), 404
|
||||||
|
|
||||||
|
def imagestream(camera_name, fps, height):
|
||||||
|
while True:
|
||||||
|
# max out at specified FPS
|
||||||
|
time.sleep(1/fps)
|
||||||
|
frame = object_processor.get_current_frame(camera_name)
|
||||||
|
if frame is None:
|
||||||
|
frame = np.zeros((height,int(height*16/9),3), np.uint8)
|
||||||
|
|
||||||
|
width = int(height*frame.shape[1]/frame.shape[0])
|
||||||
|
|
||||||
|
frame = cv2.resize(frame, dsize=(width, height), interpolation=cv2.INTER_LINEAR)
|
||||||
|
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
|
||||||
|
|
||||||
|
ret, jpg = cv2.imencode('.jpg', frame)
|
||||||
|
yield (b'--frame\r\n'
|
||||||
|
b'Content-Type: image/jpeg\r\n\r\n' + jpg.tobytes() + b'\r\n\r\n')
|
||||||
|
|
||||||
|
app.run(host='0.0.0.0', port=WEB_PORT, debug=False)
|
||||||
|
|
||||||
|
object_processor.join()
|
||||||
|
|
||||||
|
plasma_process.terminate()
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
@@ -1,41 +0,0 @@
|
|||||||
version: "3"
|
|
||||||
services:
|
|
||||||
devcontainer:
|
|
||||||
container_name: frigate-devcontainer
|
|
||||||
# add groups from host for render, plugdev, video
|
|
||||||
group_add:
|
|
||||||
- "109" # render
|
|
||||||
- "110" # render
|
|
||||||
- "44" # video
|
|
||||||
- "46" # plugdev
|
|
||||||
shm_size: "256mb"
|
|
||||||
build:
|
|
||||||
context: .
|
|
||||||
dockerfile: docker/main/Dockerfile
|
|
||||||
# Use target devcontainer-trt for TensorRT dev
|
|
||||||
target: devcontainer
|
|
||||||
## Uncomment this block for nvidia gpu support
|
|
||||||
# deploy:
|
|
||||||
# resources:
|
|
||||||
# reservations:
|
|
||||||
# devices:
|
|
||||||
# - driver: nvidia
|
|
||||||
# count: 1
|
|
||||||
# capabilities: [gpu]
|
|
||||||
environment:
|
|
||||||
YOLO_MODELS: yolov7-320
|
|
||||||
devices:
|
|
||||||
- /dev/bus/usb:/dev/bus/usb
|
|
||||||
# - /dev/dri:/dev/dri # for intel hwaccel, needs to be updated for your hardware
|
|
||||||
volumes:
|
|
||||||
- .:/workspace/frigate:cached
|
|
||||||
- ./web/dist:/opt/frigate/web:cached
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
- ./config:/config
|
|
||||||
- ./debug:/media/frigate
|
|
||||||
- /dev/bus/usb:/dev/bus/usb
|
|
||||||
mqtt:
|
|
||||||
container_name: mqtt
|
|
||||||
image: eclipse-mosquitto:1.6
|
|
||||||
ports:
|
|
||||||
- "1883:1883"
|
|
||||||
@@ -1,241 +0,0 @@
|
|||||||
# syntax=docker/dockerfile:1.6
|
|
||||||
|
|
||||||
# https://askubuntu.com/questions/972516/debian-frontend-environment-variable
|
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
|
||||||
|
|
||||||
ARG BASE_IMAGE=debian:11
|
|
||||||
ARG SLIM_BASE=debian:11-slim
|
|
||||||
|
|
||||||
FROM ${BASE_IMAGE} AS base
|
|
||||||
|
|
||||||
FROM --platform=${BUILDPLATFORM} debian:11 AS base_host
|
|
||||||
|
|
||||||
FROM ${SLIM_BASE} AS slim-base
|
|
||||||
|
|
||||||
FROM slim-base AS wget
|
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install -y wget xz-utils \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
WORKDIR /rootfs
|
|
||||||
|
|
||||||
FROM base AS nginx
|
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
ENV CCACHE_DIR /root/.ccache
|
|
||||||
ENV CCACHE_MAXSIZE 2G
|
|
||||||
|
|
||||||
# bind /var/cache/apt to tmpfs to speed up nginx build
|
|
||||||
RUN --mount=type=tmpfs,target=/tmp --mount=type=tmpfs,target=/var/cache/apt \
|
|
||||||
--mount=type=bind,source=docker/main/build_nginx.sh,target=/deps/build_nginx.sh \
|
|
||||||
--mount=type=cache,target=/root/.ccache \
|
|
||||||
/deps/build_nginx.sh
|
|
||||||
|
|
||||||
FROM scratch AS go2rtc
|
|
||||||
ARG TARGETARCH
|
|
||||||
WORKDIR /rootfs/usr/local/go2rtc/bin
|
|
||||||
ADD --link --chmod=755 "https://github.com/AlexxIT/go2rtc/releases/download/v1.9.4/go2rtc_linux_${TARGETARCH}" go2rtc
|
|
||||||
|
|
||||||
FROM wget AS tempio
|
|
||||||
ARG TARGETARCH
|
|
||||||
RUN --mount=type=bind,source=docker/main/install_tempio.sh,target=/deps/install_tempio.sh \
|
|
||||||
/deps/install_tempio.sh
|
|
||||||
|
|
||||||
####
|
|
||||||
#
|
|
||||||
# OpenVino Support
|
|
||||||
#
|
|
||||||
# 1. Download and convert a model from Intel's Public Open Model Zoo
|
|
||||||
#
|
|
||||||
####
|
|
||||||
# Download and Convert OpenVino model
|
|
||||||
FROM base_host AS ov-converter
|
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
|
|
||||||
# Install OpenVino Runtime and Dev library
|
|
||||||
COPY docker/main/requirements-ov.txt /requirements-ov.txt
|
|
||||||
RUN apt-get -qq update \
|
|
||||||
&& apt-get -qq install -y wget python3 python3-dev python3-distutils gcc pkg-config libhdf5-dev \
|
|
||||||
&& wget -q https://bootstrap.pypa.io/get-pip.py -O get-pip.py \
|
|
||||||
&& python3 get-pip.py "pip" \
|
|
||||||
&& pip install -r /requirements-ov.txt
|
|
||||||
|
|
||||||
# Get OpenVino Model
|
|
||||||
RUN --mount=type=bind,source=docker/main/build_ov_model.py,target=/build_ov_model.py \
|
|
||||||
mkdir /models && cd /models \
|
|
||||||
&& wget http://download.tensorflow.org/models/object_detection/ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz \
|
|
||||||
&& tar -xvf ssdlite_mobilenet_v2_coco_2018_05_09.tar.gz \
|
|
||||||
&& python3 /build_ov_model.py
|
|
||||||
|
|
||||||
FROM wget AS models
|
|
||||||
|
|
||||||
# Get model and labels
|
|
||||||
RUN wget -qO edgetpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess_edgetpu.tflite
|
|
||||||
RUN wget -qO cpu_model.tflite https://github.com/google-coral/test_data/raw/release-frogfish/ssdlite_mobiledet_coco_qat_postprocess.tflite
|
|
||||||
COPY labelmap.txt .
|
|
||||||
# Copy OpenVino model
|
|
||||||
COPY --from=ov-converter /models/ssdlite_mobilenet_v2.xml openvino-model/
|
|
||||||
COPY --from=ov-converter /models/ssdlite_mobilenet_v2.bin 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 && \
|
|
||||||
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
|
|
||||||
ARG TARGETARCH
|
|
||||||
RUN --mount=type=bind,source=docker/main/install_s6_overlay.sh,target=/deps/install_s6_overlay.sh \
|
|
||||||
/deps/install_s6_overlay.sh
|
|
||||||
|
|
||||||
|
|
||||||
FROM base AS wheels
|
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
# Use a separate container to build wheels to prevent build dependencies in final image
|
|
||||||
RUN apt-get -qq update \
|
|
||||||
&& apt-get -qq install -y \
|
|
||||||
apt-transport-https \
|
|
||||||
gnupg \
|
|
||||||
wget \
|
|
||||||
# the key fingerprint can be obtained from https://ftp-master.debian.org/keys.html
|
|
||||||
&& 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 install -y \
|
|
||||||
python3.9 \
|
|
||||||
python3.9-dev \
|
|
||||||
# opencv dependencies
|
|
||||||
build-essential cmake git pkg-config 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 libssl-dev\
|
|
||||||
libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \
|
|
||||||
libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
|
|
||||||
# scipy dependencies
|
|
||||||
gcc gfortran libopenblas-dev liblapack-dev && \
|
|
||||||
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"
|
|
||||||
|
|
||||||
COPY docker/main/requirements.txt /requirements.txt
|
|
||||||
RUN pip3 install -r /requirements.txt
|
|
||||||
|
|
||||||
COPY docker/main/requirements-wheels.txt /requirements-wheels.txt
|
|
||||||
RUN pip3 wheel --wheel-dir=/wheels -r /requirements-wheels.txt
|
|
||||||
|
|
||||||
|
|
||||||
# Collect deps in a single layer
|
|
||||||
FROM scratch AS deps-rootfs
|
|
||||||
COPY --from=nginx /usr/local/nginx/ /usr/local/nginx/
|
|
||||||
COPY --from=go2rtc /rootfs/ /
|
|
||||||
COPY --from=tempio /rootfs/ /
|
|
||||||
COPY --from=s6-overlay /rootfs/ /
|
|
||||||
COPY --from=models /rootfs/ /
|
|
||||||
COPY docker/main/rootfs/ /
|
|
||||||
|
|
||||||
|
|
||||||
# Frigate deps (ffmpeg, python, nginx, go2rtc, s6-overlay, etc)
|
|
||||||
FROM slim-base AS deps
|
|
||||||
ARG TARGETARCH
|
|
||||||
|
|
||||||
ARG DEBIAN_FRONTEND
|
|
||||||
# http://stackoverflow.com/questions/48162574/ddg#49462622
|
|
||||||
ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
|
|
||||||
|
|
||||||
# https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(Native-GPU-Support)
|
|
||||||
ENV NVIDIA_VISIBLE_DEVICES=all
|
|
||||||
ENV NVIDIA_DRIVER_CAPABILITIES="compute,video,utility"
|
|
||||||
|
|
||||||
ENV PATH="/usr/lib/btbn-ffmpeg/bin:/usr/local/go2rtc/bin:/usr/local/tempio/bin:/usr/local/nginx/sbin:${PATH}"
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
RUN --mount=type=bind,source=docker/main/install_deps.sh,target=/deps/install_deps.sh \
|
|
||||||
/deps/install_deps.sh
|
|
||||||
|
|
||||||
RUN --mount=type=bind,from=wheels,source=/wheels,target=/deps/wheels \
|
|
||||||
python3 -m pip install --upgrade pip && \
|
|
||||||
pip3 install -U /deps/wheels/*.whl
|
|
||||||
|
|
||||||
COPY --from=deps-rootfs / /
|
|
||||||
|
|
||||||
EXPOSE 5000
|
|
||||||
EXPOSE 8554
|
|
||||||
EXPOSE 8555/tcp 8555/udp
|
|
||||||
|
|
||||||
# Configure logging to prepend timestamps, log to stdout, keep 0 archives and rotate on 10MB
|
|
||||||
ENV S6_LOGGING_SCRIPT="T 1 n0 s10000000 T"
|
|
||||||
# Do not fail on long-running download scripts
|
|
||||||
ENV S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
|
|
||||||
|
|
||||||
ENTRYPOINT ["/init"]
|
|
||||||
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
|
|
||||||
FROM deps AS devcontainer
|
|
||||||
|
|
||||||
# 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
|
|
||||||
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
|
|
||||||
RUN mkdir -p /opt/frigate \
|
|
||||||
&& ln -svf /workspace/frigate/frigate /opt/frigate/frigate
|
|
||||||
|
|
||||||
# Install Node 20
|
|
||||||
RUN curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh && \
|
|
||||||
chmod 500 nsolid_setup_deb.sh && \
|
|
||||||
./nsolid_setup_deb.sh 20 && \
|
|
||||||
apt-get install nodejs -y \
|
|
||||||
&& rm -rf /var/lib/apt/lists/* \
|
|
||||||
&& npm install -g npm@10
|
|
||||||
|
|
||||||
WORKDIR /workspace/frigate
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get install make -y \
|
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
RUN --mount=type=bind,source=./docker/main/requirements-dev.txt,target=/workspace/frigate/requirements-dev.txt \
|
|
||||||
pip3 install -r requirements-dev.txt
|
|
||||||
|
|
||||||
HEALTHCHECK NONE
|
|
||||||
|
|
||||||
CMD ["sleep", "infinity"]
|
|
||||||
|
|
||||||
|
|
||||||
# Frigate web build
|
|
||||||
# This should be architecture agnostic, so speed up the build on multiarch by not using QEMU.
|
|
||||||
FROM --platform=$BUILDPLATFORM node:20 AS web-build
|
|
||||||
|
|
||||||
WORKDIR /work
|
|
||||||
COPY web/package.json web/package-lock.json ./
|
|
||||||
RUN npm install
|
|
||||||
|
|
||||||
COPY web/ ./
|
|
||||||
RUN npm run build \
|
|
||||||
&& mv dist/BASE_PATH/monacoeditorwork/* dist/assets/ \
|
|
||||||
&& rm -rf dist/BASE_PATH
|
|
||||||
|
|
||||||
# Collect final files in a single layer
|
|
||||||
FROM scratch AS rootfs
|
|
||||||
|
|
||||||
WORKDIR /opt/frigate/
|
|
||||||
COPY frigate frigate/
|
|
||||||
COPY migrations migrations/
|
|
||||||
COPY --from=web-build /work/dist/ web/
|
|
||||||
|
|
||||||
# Frigate final container
|
|
||||||
FROM deps AS frigate
|
|
||||||
|
|
||||||
WORKDIR /opt/frigate/
|
|
||||||
COPY --from=rootfs / /
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
NGINX_VERSION="1.25.3"
|
|
||||||
VOD_MODULE_VERSION="1.31"
|
|
||||||
SECURE_TOKEN_MODULE_VERSION="1.5"
|
|
||||||
SET_MISC_MODULE_VERSION="v0.33"
|
|
||||||
NGX_DEVEL_KIT_VERSION="v0.3.3"
|
|
||||||
|
|
||||||
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
|
|
||||||
apt-get update
|
|
||||||
|
|
||||||
apt-get -yqq build-dep nginx
|
|
||||||
|
|
||||||
apt-get -yqq install --no-install-recommends ca-certificates wget
|
|
||||||
update-ca-certificates -f
|
|
||||||
apt install -y ccache
|
|
||||||
|
|
||||||
export PATH="/usr/lib/ccache:$PATH"
|
|
||||||
|
|
||||||
mkdir /tmp/nginx
|
|
||||||
wget -nv https://nginx.org/download/nginx-${NGINX_VERSION}.tar.gz
|
|
||||||
tar -zxf nginx-${NGINX_VERSION}.tar.gz -C /tmp/nginx --strip-components=1
|
|
||||||
rm nginx-${NGINX_VERSION}.tar.gz
|
|
||||||
mkdir /tmp/nginx-vod-module
|
|
||||||
wget -nv https://github.com/kaltura/nginx-vod-module/archive/refs/tags/${VOD_MODULE_VERSION}.tar.gz
|
|
||||||
tar -zxf ${VOD_MODULE_VERSION}.tar.gz -C /tmp/nginx-vod-module --strip-components=1
|
|
||||||
rm ${VOD_MODULE_VERSION}.tar.gz
|
|
||||||
# Patch MAX_CLIPS to allow more clips to be added than the default 128
|
|
||||||
sed -i 's/MAX_CLIPS (128)/MAX_CLIPS (1080)/g' /tmp/nginx-vod-module/vod/media_set.h
|
|
||||||
patch -d /tmp/nginx-vod-module/ -p1 << 'EOF'
|
|
||||||
--- a/vod/avc_hevc_parser.c 2022-06-27 11:38:10.000000000 +0000
|
|
||||||
+++ b/vod/avc_hevc_parser.c 2023-01-16 11:25:10.900521298 +0000
|
|
||||||
@@ -3,6 +3,9 @@
|
|
||||||
bool_t
|
|
||||||
avc_hevc_parser_rbsp_trailing_bits(bit_reader_state_t* reader)
|
|
||||||
{
|
|
||||||
+ // https://github.com/blakeblackshear/frigate/issues/4572
|
|
||||||
+ return TRUE;
|
|
||||||
+
|
|
||||||
uint32_t one_bit;
|
|
||||||
|
|
||||||
if (reader->stream.eof_reached)
|
|
||||||
EOF
|
|
||||||
|
|
||||||
|
|
||||||
mkdir /tmp/nginx-secure-token-module
|
|
||||||
wget https://github.com/kaltura/nginx-secure-token-module/archive/refs/tags/${SECURE_TOKEN_MODULE_VERSION}.tar.gz
|
|
||||||
tar -zxf ${SECURE_TOKEN_MODULE_VERSION}.tar.gz -C /tmp/nginx-secure-token-module --strip-components=1
|
|
||||||
rm ${SECURE_TOKEN_MODULE_VERSION}.tar.gz
|
|
||||||
|
|
||||||
mkdir /tmp/ngx_devel_kit
|
|
||||||
wget https://github.com/vision5/ngx_devel_kit/archive/refs/tags/${NGX_DEVEL_KIT_VERSION}.tar.gz
|
|
||||||
tar -zxf ${NGX_DEVEL_KIT_VERSION}.tar.gz -C /tmp/ngx_devel_kit --strip-components=1
|
|
||||||
rm ${NGX_DEVEL_KIT_VERSION}.tar.gz
|
|
||||||
|
|
||||||
mkdir /tmp/nginx-set-misc-module
|
|
||||||
wget https://github.com/openresty/set-misc-nginx-module/archive/refs/tags/${SET_MISC_MODULE_VERSION}.tar.gz
|
|
||||||
tar -zxf ${SET_MISC_MODULE_VERSION}.tar.gz -C /tmp/nginx-set-misc-module --strip-components=1
|
|
||||||
rm ${SET_MISC_MODULE_VERSION}.tar.gz
|
|
||||||
|
|
||||||
cd /tmp/nginx
|
|
||||||
|
|
||||||
./configure --prefix=/usr/local/nginx \
|
|
||||||
--with-file-aio \
|
|
||||||
--with-http_sub_module \
|
|
||||||
--with-http_ssl_module \
|
|
||||||
--with-http_auth_request_module \
|
|
||||||
--with-http_realip_module \
|
|
||||||
--with-threads \
|
|
||||||
--add-module=../ngx_devel_kit \
|
|
||||||
--add-module=../nginx-set-misc-module \
|
|
||||||
--add-module=../nginx-vod-module \
|
|
||||||
--add-module=../nginx-secure-token-module \
|
|
||||||
--with-cc-opt="-O3 -Wno-error=implicit-fallthrough"
|
|
||||||
|
|
||||||
make CC="ccache gcc" -j$(nproc) && make install
|
|
||||||
rm -rf /usr/local/nginx/html /usr/local/nginx/conf/*.default
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
import openvino as ov
|
|
||||||
from openvino.tools import mo
|
|
||||||
|
|
||||||
ov_model = mo.convert_model(
|
|
||||||
"/models/ssdlite_mobilenet_v2_coco_2018_05_09/frozen_inference_graph.pb",
|
|
||||||
compress_to_fp16=True,
|
|
||||||
transformations_config="/usr/local/lib/python3.9/dist-packages/openvino/tools/mo/front/tf/ssd_v2_support.json",
|
|
||||||
tensorflow_object_detection_api_pipeline_config="/models/ssdlite_mobilenet_v2_coco_2018_05_09/pipeline.config",
|
|
||||||
reverse_input_channels=True,
|
|
||||||
)
|
|
||||||
ov.save_model(ov_model, "/models/ssdlite_mobilenet_v2.xml")
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Start the fake Frigate service
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Tell S6-Overlay not to restart this service
|
|
||||||
s6-svc -O .
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
echo "[INFO] The fake Frigate service is running..."
|
|
||||||
sleep 5s
|
|
||||||
done
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
#!/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.9 \
|
|
||||||
python3-pip \
|
|
||||||
curl \
|
|
||||||
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
|
|
||||||
|
|
||||||
# add coral repo
|
|
||||||
curl -fsSLo - https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
|
|
||||||
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
|
|
||||||
|
|
||||||
# enable non-free repo in Debian
|
|
||||||
if grep -q "Debian" /etc/issue; then
|
|
||||||
sed -i -e's/ main/ main contrib non-free/g' /etc/apt/sources.list
|
|
||||||
fi
|
|
||||||
|
|
||||||
# coral drivers
|
|
||||||
apt-get -qq update
|
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
|
||||||
libedgetpu1-max python3-tflite-runtime python3-pycoral
|
|
||||||
|
|
||||||
# btbn-ffmpeg -> amd64
|
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
|
||||||
mkdir -p /usr/lib/btbn-ffmpeg
|
|
||||||
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-linux64-gpl-5.1.tar.xz"
|
|
||||||
tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/btbn-ffmpeg --strip-components 1
|
|
||||||
rm -rf btbn-ffmpeg.tar.xz /usr/lib/btbn-ffmpeg/doc /usr/lib/btbn-ffmpeg/bin/ffplay
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ffmpeg -> arm64
|
|
||||||
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
|
||||||
mkdir -p /usr/lib/btbn-ffmpeg
|
|
||||||
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"
|
|
||||||
tar -xf btbn-ffmpeg.tar.xz -C /usr/lib/btbn-ffmpeg --strip-components 1
|
|
||||||
rm -rf btbn-ffmpeg.tar.xz /usr/lib/btbn-ffmpeg/doc /usr/lib/btbn-ffmpeg/bin/ffplay
|
|
||||||
fi
|
|
||||||
|
|
||||||
# arch specific packages
|
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
|
||||||
# use debian bookworm for hwaccel packages
|
|
||||||
echo 'deb https://deb.debian.org/debian bookworm main contrib non-free' >/etc/apt/sources.list.d/debian-bookworm.list
|
|
||||||
apt-get -qq update
|
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
|
||||||
intel-opencl-icd \
|
|
||||||
mesa-va-drivers radeontop 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
|
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
|
||||||
i965-va-driver-shaders
|
|
||||||
rm -f /etc/apt/sources.list.d/debian-bookworm.list
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "${TARGETARCH}" == "arm64" ]]; then
|
|
||||||
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
|
||||||
libva-drm2 mesa-va-drivers
|
|
||||||
fi
|
|
||||||
|
|
||||||
apt-get purge gnupg apt-transport-https xz-utils -y
|
|
||||||
apt-get clean autoclean -y
|
|
||||||
apt-get autoremove --purge -y
|
|
||||||
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
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
s6_version="3.1.5.0"
|
|
||||||
|
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
|
||||||
s6_arch="x86_64"
|
|
||||||
elif [[ "${TARGETARCH}" == "arm64" ]]; then
|
|
||||||
s6_arch="aarch64"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p /rootfs/
|
|
||||||
|
|
||||||
wget -qO- "https://github.com/just-containers/s6-overlay/releases/download/v${s6_version}/s6-overlay-noarch.tar.xz" |
|
|
||||||
tar -C /rootfs/ -Jxpf -
|
|
||||||
|
|
||||||
wget -qO- "https://github.com/just-containers/s6-overlay/releases/download/v${s6_version}/s6-overlay-${s6_arch}.tar.xz" |
|
|
||||||
tar -C /rootfs/ -Jxpf -
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
set -euxo pipefail
|
|
||||||
|
|
||||||
tempio_version="2021.09.0"
|
|
||||||
|
|
||||||
if [[ "${TARGETARCH}" == "amd64" ]]; then
|
|
||||||
arch="amd64"
|
|
||||||
elif [[ "${TARGETARCH}" == "arm64" ]]; then
|
|
||||||
arch="aarch64"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p /rootfs/usr/local/tempio/bin
|
|
||||||
|
|
||||||
wget -q -O /rootfs/usr/local/tempio/bin/tempio "https://github.com/home-assistant/tempio/releases/download/${tempio_version}/tempio_${arch}"
|
|
||||||
chmod 755 /rootfs/usr/local/tempio/bin/tempio
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ruff
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
numpy
|
|
||||||
tensorflow
|
|
||||||
openvino-dev>=2024.0.0
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
click == 8.1.*
|
|
||||||
Flask == 3.0.*
|
|
||||||
Flask_Limiter == 3.7.*
|
|
||||||
imutils == 0.5.*
|
|
||||||
joserfc == 0.11.*
|
|
||||||
markupsafe == 2.1.*
|
|
||||||
matplotlib == 3.8.*
|
|
||||||
mypy == 1.6.1
|
|
||||||
numpy == 1.26.*
|
|
||||||
onvif_zeep == 0.2.12
|
|
||||||
opencv-python-headless == 4.9.0.*
|
|
||||||
paho-mqtt == 2.1.*
|
|
||||||
pandas == 2.2.*
|
|
||||||
peewee == 3.17.*
|
|
||||||
peewee_migrate == 1.12.*
|
|
||||||
psutil == 5.9.*
|
|
||||||
pydantic == 2.7.*
|
|
||||||
git+https://github.com/fbcotter/py3nvml#egg=py3nvml
|
|
||||||
PyYAML == 6.0.*
|
|
||||||
pytz == 2024.1
|
|
||||||
pyzmq == 26.0.*
|
|
||||||
ruamel.yaml == 0.18.*
|
|
||||||
tzlocal == 5.2
|
|
||||||
types-PyYAML == 6.0.*
|
|
||||||
requests == 2.32.*
|
|
||||||
types-requests == 2.32.*
|
|
||||||
scipy == 1.13.*
|
|
||||||
norfair == 2.2.*
|
|
||||||
setproctitle == 1.3.*
|
|
||||||
ws4py == 0.5.*
|
|
||||||
unidecode == 1.3.*
|
|
||||||
onnxruntime == 1.18.*
|
|
||||||
openvino == 2024.1.*
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
scikit-build == 0.18.*
|
|
||||||
nvidia-pyindex
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
certsync
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
certsync-pipeline
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
exec logutil-service /dev/shm/logs/certsync
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Take down the S6 supervision tree when the service fails
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
declare exit_code_container
|
|
||||||
exit_code_container=$(cat /run/s6-linux-init-container-results/exitcode)
|
|
||||||
readonly exit_code_container
|
|
||||||
readonly exit_code_service="${1}"
|
|
||||||
readonly exit_code_signal="${2}"
|
|
||||||
readonly service="CERTSYNC"
|
|
||||||
|
|
||||||
echo "[INFO] Service ${service} exited with code ${exit_code_service} (by signal ${exit_code_signal})"
|
|
||||||
|
|
||||||
if [[ "${exit_code_service}" -eq 256 ]]; then
|
|
||||||
if [[ "${exit_code_container}" -eq 0 ]]; then
|
|
||||||
echo $((128 + exit_code_signal)) >/run/s6-linux-init-container-results/exitcode
|
|
||||||
fi
|
|
||||||
if [[ "${exit_code_signal}" -eq 15 ]]; then
|
|
||||||
exec /run/s6/basedir/bin/halt
|
|
||||||
fi
|
|
||||||
elif [[ "${exit_code_service}" -ne 0 ]]; then
|
|
||||||
if [[ "${exit_code_container}" -eq 0 ]]; then
|
|
||||||
echo "${exit_code_service}" >/run/s6-linux-init-container-results/exitcode
|
|
||||||
fi
|
|
||||||
exec /run/s6/basedir/bin/halt
|
|
||||||
fi
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
certsync-log
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Start the CERTSYNC service
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
echo "[INFO] Starting certsync..."
|
|
||||||
|
|
||||||
lefile="/etc/letsencrypt/live/frigate/fullchain.pem"
|
|
||||||
|
|
||||||
tls_enabled=`python3 /usr/local/nginx/get_tls_settings.py | jq -r .enabled`
|
|
||||||
|
|
||||||
while true
|
|
||||||
do
|
|
||||||
if [[ "$tls_enabled" == 'false' ]]; then
|
|
||||||
sleep 9999
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e $lefile ]
|
|
||||||
then
|
|
||||||
echo "[ERROR] TLS certificate does not exist: $lefile"
|
|
||||||
fi
|
|
||||||
|
|
||||||
leprint=`openssl x509 -in $lefile -fingerprint -noout 2>&1 || echo 'failed'`
|
|
||||||
|
|
||||||
case "$leprint" in
|
|
||||||
*Fingerprint*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "[ERROR] Missing fingerprint from $lefile"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
liveprint=`echo | openssl s_client -showcerts -connect 127.0.0.1:8080 2>&1 | openssl x509 -fingerprint 2>&1 | grep -i fingerprint || echo 'failed'`
|
|
||||||
|
|
||||||
case "$liveprint" in
|
|
||||||
*Fingerprint*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "[ERROR] Missing fingerprint from current nginx TLS cert"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
if [[ "$leprint" != "failed" && "$liveprint" != "failed" && "$leprint" != "$liveprint" ]]
|
|
||||||
then
|
|
||||||
echo "[INFO] Reloading nginx to refresh TLS certificate"
|
|
||||||
echo "$lefile: $leprint"
|
|
||||||
/usr/local/nginx/sbin/nginx -s reload
|
|
||||||
fi
|
|
||||||
|
|
||||||
sleep 60
|
|
||||||
|
|
||||||
done
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
30000
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
frigate
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
frigate-pipeline
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
exec logutil-service /dev/shm/logs/frigate
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Take down the S6 supervision tree when the service exits
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
declare exit_code_container
|
|
||||||
exit_code_container=$(cat /run/s6-linux-init-container-results/exitcode)
|
|
||||||
readonly exit_code_container
|
|
||||||
readonly exit_code_service="${1}"
|
|
||||||
readonly exit_code_signal="${2}"
|
|
||||||
readonly service="Frigate"
|
|
||||||
|
|
||||||
echo "[INFO] Service ${service} exited with code ${exit_code_service} (by signal ${exit_code_signal})"
|
|
||||||
|
|
||||||
if [[ "${exit_code_service}" -eq 256 ]]; then
|
|
||||||
if [[ "${exit_code_container}" -eq 0 ]]; then
|
|
||||||
echo $((128 + exit_code_signal)) >/run/s6-linux-init-container-results/exitcode
|
|
||||||
fi
|
|
||||||
elif [[ "${exit_code_service}" -ne 0 ]]; then
|
|
||||||
if [[ "${exit_code_container}" -eq 0 ]]; then
|
|
||||||
echo "${exit_code_service}" >/run/s6-linux-init-container-results/exitcode
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
exec /run/s6/basedir/bin/halt
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
frigate-log
|
|
||||||
@@ -1,55 +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 .
|
|
||||||
|
|
||||||
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
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
120000
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
readonly exit_code_service="${1}"
|
|
||||||
readonly exit_code_signal="${2}"
|
|
||||||
readonly service="go2rtc-healthcheck"
|
|
||||||
|
|
||||||
echo "[INFO] The ${service} service exited with code ${exit_code_service} (by signal ${exit_code_signal})"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
go2rtc-log
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Start the go2rtc-healthcheck service
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
# Give some additional time for go2rtc to start before start pinging
|
|
||||||
sleep 10s
|
|
||||||
echo "[INFO] Starting go2rtc healthcheck service..."
|
|
||||||
|
|
||||||
while sleep 30s; do
|
|
||||||
# Check if the service is running
|
|
||||||
if ! curl --connect-timeout 10 --fail --silent --show-error --output /dev/null http://127.0.0.1:1984/api/streams 2>&1; then
|
|
||||||
echo "[ERROR] The go2rtc service is not responding to ping, restarting..."
|
|
||||||
# We can also use -r instead of -t to send kill signal rather than term
|
|
||||||
s6-svc -t /var/run/service/go2rtc 2>&1
|
|
||||||
# Give some additional time to go2rtc to restart before start pinging again
|
|
||||||
sleep 10s
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
5000
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
go2rtc
|
|
||||||
go2rtc-healthcheck
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
go2rtc-pipeline
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
exec logutil-service /dev/shm/logs/go2rtc
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
readonly exit_code_service="${1}"
|
|
||||||
readonly exit_code_signal="${2}"
|
|
||||||
readonly service="go2rtc"
|
|
||||||
|
|
||||||
echo "[INFO] The ${service} service exited with code ${exit_code_service} (by signal ${exit_code_signal})"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
go2rtc-log
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Start the go2rtc service
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
# Logs should be sent to stdout so that s6 can collect them
|
|
||||||
|
|
||||||
function get_ip_and_port_from_supervisor() {
|
|
||||||
local ip_address
|
|
||||||
# Example: 192.168.1.10/24
|
|
||||||
local ip_regex='^([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3})/[0-9]{1,2}$'
|
|
||||||
if ip_address=$(
|
|
||||||
curl -fsSL \
|
|
||||||
-H "Authorization: Bearer ${SUPERVISOR_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
http://supervisor/network/interface/default/info |
|
|
||||||
jq --exit-status --raw-output '.data.ipv4.address[0]'
|
|
||||||
) && [[ "${ip_address}" =~ ${ip_regex} ]]; then
|
|
||||||
ip_address="${BASH_REMATCH[1]}"
|
|
||||||
echo "[INFO] Got IP address from supervisor: ${ip_address}"
|
|
||||||
else
|
|
||||||
echo "[WARN] Failed to get IP address from supervisor"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
local webrtc_port
|
|
||||||
local port_regex='^([0-9]{1,5})$'
|
|
||||||
if webrtc_port=$(
|
|
||||||
curl -fsSL \
|
|
||||||
-H "Authorization: Bearer ${SUPERVISOR_TOKEN}" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
http://supervisor/addons/self/info |
|
|
||||||
jq --exit-status --raw-output '.data.network["8555/tcp"]'
|
|
||||||
) && [[ "${webrtc_port}" =~ ${port_regex} ]]; then
|
|
||||||
webrtc_port="${BASH_REMATCH[1]}"
|
|
||||||
echo "[INFO] Got WebRTC port from supervisor: ${webrtc_port}"
|
|
||||||
else
|
|
||||||
echo "[WARN] Failed to get WebRTC port from supervisor"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
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
|
|
||||||
echo "[INFO] Removing stale config from last run..."
|
|
||||||
rm /dev/shm/go2rtc.yaml
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! -f "/dev/shm/go2rtc.yaml" ]]; then
|
|
||||||
echo "[INFO] Preparing new go2rtc config..."
|
|
||||||
|
|
||||||
if [[ -n "${SUPERVISOR_TOKEN:-}" ]]; then
|
|
||||||
# Running as a Home Assistant add-on, infer the IP address and port
|
|
||||||
get_ip_and_port_from_supervisor
|
|
||||||
fi
|
|
||||||
|
|
||||||
python3 /usr/local/go2rtc/create_config.py
|
|
||||||
else
|
|
||||||
echo "[WARNING] Unable to remove existing go2rtc config. Changes made to your frigate config file may not be recognized. Please remove the /dev/shm/go2rtc.yaml from your docker host manually."
|
|
||||||
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..."
|
|
||||||
|
|
||||||
# Replace the bash process with the go2rtc process, redirecting stderr to stdout
|
|
||||||
exec 2>&1
|
|
||||||
exec "${binary_path}" -config=/dev/shm/go2rtc.yaml
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
30000
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
# Prepare the logs folder for s6-log
|
|
||||||
|
|
||||||
set -o errexit -o nounset -o pipefail
|
|
||||||
|
|
||||||
dirs=(/dev/shm/logs/frigate /dev/shm/logs/go2rtc /dev/shm/logs/nginx /dev/shm/logs/certsync)
|
|
||||||
|
|
||||||
mkdir -p "${dirs[@]}"
|
|
||||||
chown nobody:nogroup "${dirs[@]}"
|
|
||||||
chmod 02755 "${dirs[@]}"
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
oneshot
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
/etc/s6-overlay/s6-rc.d/log-prepare/run
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
nginx
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
nginx-pipeline
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/command/with-contenv bash
|
|
||||||
# shellcheck shell=bash
|
|
||||||
|
|
||||||
exec logutil-service /dev/shm/logs/nginx
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
longrun
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
set -e
|
|
||||||
|
|
||||||
# Wait for PID file to exist.
|
|
||||||
while ! test -f /run/nginx.pid; do sleep 1; done
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user