Skip to content

Commit 9964d0d

Browse files
committed
Merge branch 'dev'
2 parents 84c1730 + f0b4a9b commit 9964d0d

16 files changed

+400
-293
lines changed

Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ RUN mkdir -p /detectors/models/edgetpu/classification && \
4242
wget https://dl.google.com/coral/canned_models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite -O /detectors/models/edgetpu/model.tflite --progress=bar:force:noscroll && \
4343
wget https://dl.google.com/coral/canned_models/coco_labels.txt -O /detectors/models/edgetpu/labels.txt --progress=bar:force:noscroll && \
4444
# Fetch models for YOLO darknet
45+
# We are using YOLOv3 since YOLOv4 has issues with OopenCL right now https://github.com/opencv/opencv/issues/17762
4546
mkdir -p /detectors/models/darknet && \
46-
wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v3_optimal/yolov3.weights -O /detectors/models/darknet/yolo.weights --progress=bar:force:noscroll && \
47-
wget https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov3.cfg -O /detectors/models/darknet/yolo.cfg --progress=bar:force:noscroll && \
47+
wget https://pjreddie.com/media/files/yolov3-tiny.weights -O /detectors/models/darknet/yolo.weights --progress=bar:force:noscroll && \
48+
wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3-tiny.cfg -O /detectors/models/darknet/yolo.cfg --progress=bar:force:noscroll && \
4849
wget https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/coco.names -O /detectors/models/darknet/coco.names --progress=bar:force:noscroll
4950

5051
VOLUME /recordings

README.md

Lines changed: 118 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Builds are tested and verified on the following platforms:
2121
- OpenMax and MMAL on the RaspberryPi 3B+
2222

2323
# Getting started
24-
Choose the appropriate docker container for your machine.
24+
Choose the appropriate docker container for your machine. Builds are published to [Docker Hub](https://hub.docker.com/repository/docker/roflcoopter/viseron)
2525
<details>
2626
<summary>On a RaspberryPi 3b+</summary>
2727
Example Docker command
@@ -57,7 +57,9 @@ Choose the appropriate docker container for your machine.
5757
privileged: true
5858
```
5959
Note: Viseron is quite RAM intensive, mostly because of the object detection but also because of the lookback feature.\
60-
Therefore i do not recommend using an RPi unless you have a Google Coral EdgeTPU.
60+
I do not recommend using an RPi unless you have a Google Coral EdgeTPU, the CPU is not fast enough and you might run out of memory.
61+
To make use of hardware accelerated decoding/encoding you might have to increase the allocated GPU memory.\
62+
To do this edit ```/boot/config.txt``` and set ```gpu_mem=256``` and then reboot.
6163
</details>
6264

6365

@@ -158,7 +160,36 @@ If no config is present, a default minimal one will be created.\
158160
Here you need to fill in atleast your cameras and you should be good to go.
159161

160162
# Configuration Options
161-
## Camera
163+
## Cameras
164+
165+
<details>
166+
<summary>Config example</summary>
167+
168+
```yaml
169+
cameras:
170+
- name: Front door
171+
mqtt_name: viseron_front_door
172+
host: 192.168.30.2
173+
port: 554
174+
username: user
175+
password: pass
176+
path: /Streaming/Channels/101/
177+
width: 1920
178+
height: 1080
179+
fps: 6
180+
motion_detection:
181+
interval: 1
182+
trigger: false
183+
object_detection:
184+
interval: 1
185+
labels:
186+
- label: person
187+
confidence: 0.9
188+
- label: pottedplant
189+
confidence: 0.9
190+
```
191+
</details>
192+
162193
Used to build the FFMPEG command to decode camera stream.\
163194
The command is built like this: \
164195
```"ffmpeg" + global_args + input_args + hwaccel_args + codec + "-rtsp_transport tcp -i " + (stream url) + filter_args + output_args```
@@ -179,6 +210,8 @@ The command is built like this: \
179210
| hwaccel_args | list | optional | a valid list of FFMPEG arguments | FFMPEG decoder hardware acceleration arguments |
180211
| codec | str | optional | any supported decoder codec | FFMPEG video decoder codec, eg ```h264_cuvid``` |
181212
| filter_args | list | optional | a valid list of FFMPEG arguments | See source code for default arguments |
213+
| motion_detection | dictionary | optional | see [Motion detection config](#motion-detection) | Overrides the global ```motion_detection``` config |
214+
| object_detection | list | optional | see [Camera object detection config](#camera-object-detection) below | Overrides the global ```object_detection``` config |
182215

183216
The default command varies a bit depending on the supported hardware:
184217
<details>
@@ -205,7 +238,32 @@ The default command varies a bit depending on the supported hardware:
205238
```
206239
</details>
207240
241+
### Camera object detection
242+
| Name | Type | Default | Supported options | Description |
243+
| -----| -----| ------- | ----------------- |------------ |
244+
| interval | float | optiona | any float | Run object detection at this interval in seconds. Overrides global [config](#object-detection) |
245+
| labels | list | optional | any float | A list of [labels](#labels) |
246+
208247
## Object detection
248+
<details>
249+
<summary>Config example</summary>
250+
251+
```yaml
252+
object_detection:
253+
type: darknet
254+
interval: 6
255+
labels:
256+
- label: person
257+
confidence: 0.9
258+
height_min: 0.1481
259+
height_max: 0.7
260+
width_min: 0.0598
261+
width_max: 0.36
262+
- label: truck
263+
confidence: 0.8
264+
```
265+
</details>
266+
209267
| Name | Type | Default | Supported options | Description |
210268
| -----| -----| ------- | ----------------- |------------ |
211269
| type | str | RPi: ```edgetpu``` <br> Other: ```darknet``` | ```darknet```, ```edgetpu``` | What detection method to use.</br>Defaults to ```edgetpu``` on RPi. If no EdgeTPU is present it will run tensorflow on the CPU. |
@@ -215,15 +273,36 @@ The default command varies a bit depending on the supported hardware:
215273
| model_width | int | optional | any integer | Detected from model. Frames will be resized to this width in order to fit model and save computing power. I dont recommend changing this. |
216274
| model_height | int | optional | any integer | Detected from model. Frames will be resized to this height in order to fit model and save computing power. I dont recommend changing this. |
217275
| interval | float | 1.0 | any float | Run object detection at this interval in seconds. |
218-
| threshold | float | 0.8 | float between 0 and 1 | Lowest confidence allowed for detected objects |
276+
| confidence | float | 0.8 | float between 0 and 1 | Lowest confidence allowed for detected objects |
219277
| suppression | float | 0.4 | float between 0 and 1 | Non-maxima suppression, used to remove overlapping detections |
278+
| labels | list | optional | any string | A list of [labels](#labels) |
279+
280+
### Labels
281+
| Name | Type | Default | Supported options | Description |
282+
| -----| -----| ------- | ----------------- |------------ |
283+
| label | str | person | any string | Can be any label present in the detection model |
220284
| height_min | float | 0 | float between 0 and 1 | Minimum height allowed for detected objects, relative to stream height |
221285
| height_max | float | 1 | float between 0 and 1 | Maximum height allowed for detected objects, relative to stream height |
222286
| width_min | float | 0 | float between 0 and 1 | Minimum width allowed for detected objects, relative to stream width |
223287
| width_max | float | 1 | float between 0 and 1 | Maximum width allowed for detected objects, relative to stream width |
224-
| labels | list | ```person``` | any string | Can be any label present in the detection model |
288+
225289

226290
## Motion detection
291+
<details>
292+
<summary>Config example</summary>
293+
294+
```yaml
295+
motion_detection:
296+
interval: 1
297+
trigger: true
298+
timeout: true
299+
width: 300
300+
height: 300
301+
area: 6000
302+
frames: 3
303+
```
304+
</details>
305+
227306
| Name | Type | Default | Supported options | Description |
228307
| -----| -----| ------- | ----------------- |------------ |
229308
| interval | float | 1.0 | any float | Run motion detection at this interval in seconds |
@@ -237,12 +316,24 @@ The default command varies a bit depending on the supported hardware:
237316
TODO Future releases will make the motion detection easier to fine tune. Right now its a guessing game
238317
239318
## Recorder
319+
<details>
320+
<summary>Config example</summary>
321+
322+
```yaml
323+
recorder:
324+
lookback: 10
325+
timeout: 10
326+
retain: 7
327+
folder: /recordings
328+
```
329+
</details>
330+
240331
| Name | Type | Default | Supported options | Description |
241332
| -----| -----| ------- | ----------------- |------------ |
242333
| lookback | int | 10 | any integer | Number of seconds to record before a detected object |
243334
| timeout | int | 10 | any integer | Number of seconds to record after all events are over |
244335
| retain | int | 7 | any integer | Number of days to save recordings before deleting them |
245-
| folder | path | ```/recordings``` | What folder to store recordings in |
336+
| folder | path | ```/recordings``` | path to existing folder | What folder to store recordings in |
246337
| extension | str | ```mp4``` | a valid video file extension | The file extension used for recordings. I don't recommend changing this |
247338
| global_args | list | optional | a valid list of FFMPEG arguments | See source code for default arguments |
248339
| hwaccel_args | list | optional | a valid list of FFMPEG arguments | FFMPEG encoder hardware acceleration arguments |
@@ -275,6 +366,18 @@ The default command varies a bit depending on the supported hardware:
275366
</details>
276367
277368
## MQTT
369+
<details>
370+
<summary>Config example</summary>
371+
372+
```yaml
373+
mqtt:
374+
broker: mqtt_broker.lan
375+
port: 1883
376+
username: user
377+
password: pass
378+
```
379+
</details>
380+
278381
| Name | Type | Default | Supported options | Description |
279382
| -----| -----| ------- | ----------------- |------------ |
280383
| broker | str | **required** | IP adress or hostname | IP adress or hostname of MQTT broker |
@@ -286,6 +389,15 @@ The default command varies a bit depending on the supported hardware:
286389
| last_will_topic | str | ```{client_id}/lwt``` | Last will topic
287390

288391
## Logging
392+
<details>
393+
<summary>Config example</summary>
394+
395+
```yaml
396+
logging:
397+
level: debug
398+
```
399+
</details>
400+
289401
| Name | Type | Default | Supported options | Description |
290402
| -----| -----| ------- | ----------------- |------------ |
291403
| level | str | ```INFO``` | ```DEBUG```, ```INFO```, ```WARNING```, ```ERROR```, ```FATAL``` | Log level |
@@ -298,8 +410,6 @@ The default command varies a bit depending on the supported hardware:
298410
- Pause detection via MQTT
299411
- Move detectors to specific folder
300412
- Allow specified confidence to override height/width thresholds
301-
- Refactor Darknet
302-
- Darknet Choose backend via config
303413
- Dynamic detection interval, speed up interval when detection happens for all types of detectors
304414
- Implement an object tracker for detected objects
305415
- Make it easier to implement custom detectors
@@ -314,11 +424,6 @@ The default command varies a bit depending on the supported hardware:
314424
- Properties:
315425
All public vars should be exposed by property
316426

317-
- Decouple MQTT
318-
- One client object.
319-
- Start all camera threads, which need to expose an on_message function
320-
- Pass list of camera objects to MQTT
321-
322427
- Docker
323428
- Try to reduce container footprint
324429

docker/vaapi/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,10 +170,11 @@ RUN wget https://bootstrap.pypa.io/get-pip.py --progress=bar:force:noscroll && \
170170
-r requirements.txt && \
171171
rm requirements.txt
172172

173-
# Fetch models for YOLOv4 darknet
173+
# Fetch models for YOLOv3 darknet
174+
# We are using YOLOv3 since YOLOv4 has issues with OopenCL right now https://github.com/opencv/opencv/issues/17762
174175
RUN mkdir -p /detectors/models/darknet && \
175-
wget https://github.com/AlexeyAB/darknet/releases/download/darknet_yolo_v4_pre/yolov4-tiny.weights -O /detectors/models/darknet/yolo.weights --progress=bar:force:noscroll && \
176-
wget https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/yolov4-tiny.cfg -O /detectors/models/darknet/yolo.cfg --progress=bar:force:noscroll && \
176+
wget https://pjreddie.com/media/files/yolov3-tiny.weights -O /detectors/models/darknet/yolo.weights --progress=bar:force:noscroll && \
177+
wget https://raw.githubusercontent.com/pjreddie/darknet/master/cfg/yolov3-tiny.cfg -O /detectors/models/darknet/yolo.cfg --progress=bar:force:noscroll && \
177178
wget https://raw.githubusercontent.com/AlexeyAB/darknet/master/cfg/coco.names -O /detectors/models/darknet/coco.names --progress=bar:force:noscroll
178179

179180
# Cleanup

0 commit comments

Comments
 (0)