Sign inSign up

mdegans/nvalhalla

By mdegans

•Updated over 6 years ago

sample DeepStream app written in Genie, a Vala dialect

Image
0

736

mdegans/nvalhalla repository overview

⁠NValhalla

Is a simple DeepStream test app to perform live redaction and social distancing an an arbitrary number of sources. NValhalla is written in Genie, a Vala dialect⁠.

Usage is nvalhalla --uri rtsp://uri-goes-here/ --uri file://local/file/here.mp4 ... where each --uri supplied is a valid uri accepted by uridecodebin⁠. Full help, including --gst options are available with --help

Since the v0.1.6 release, social distancing mode can be enabled by adding --kenneth as a flag. Guaranteed to blow the Covid away⁠. Distancing mode uses an int8 quantized model packaged with DeepStream where supported by the hardware, so performance should be much better than the redaction mode.

source here⁠

⁠Running in Docker

Example with youtube sources (youtube-dl needs to be installed on the host with pip3 install youtube-dl or similar):

docker run --gpus all -p 8554:8554 --rm mdegans/nvalhalla --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=awdX61DPWf4) --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=FPs_lU01KoI) --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=SnMBYMOTwEs) --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=jYusNNldesc)

RTSP video will be available on port 8554 at path /nvalhalla (eg: rtsp://hostname:8446/nvalhalla

Notes:

  • So far this is only tested on x86-64 NVIDIA Docker. The Dockerfile or meson.build may need to be modified for Tegra Docker support.
  • .dot files for debug, configs, and models are stored in /var/nvalhalla/.nvalhalla/...
  • verbose logging is on by default (Gst debug level 4)

⁠Examples

You can redact (or do social distancing) on multiple youtube streams like this, provided you have youtube-dl installed (pip3 install youtube-dl) and enough bandwith:

nvalhalla --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=awdX61DPWf4) --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=FPs_lU01KoI) --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=SnMBYMOTwEs) --uri $(youtube-dl -f best -g https://www.youtube.com/watch?v=jYusNNldesc)

four youtube streams at once

Local video streams can also be used like this:

nvalhalla --uri file:///home/username/Videos/test.mp4

RTSP streams are also supported:

nvalhalla --uri rtsp://hostname:port/path

Basically, any uri supported by uridecodebin⁠ will probably work. If you find a combination that doesn't, please report it⁠.

⁠FAQ

  • Can this app do anything but redaction and social distancing No, and any potentially dangerous code (eg. dumping bounding boxes) has been removed. It's hoped that you won't modify it to do anything harmful, since software for detecting faces has an immense potential for misuse.
  • Can this app redact anything other than faces? Yes. You can modify the app to do what you want by changing the config and models ~/.nvalhalla, however it will only redact IDs 0 and 1 unless you modify cb_buffer.c⁠.
  • Redaction mode is very slow on my Nano The model is currently not optimized at all, int8 and fp16 support is the next thing on the TODO list. It should run fine on a Xavier, however.
  • Why Genie? Becuase it looks like Python, I like Python, and it fits perfectly with gstreamer. The Gstreamer project actually recommends Vala⁠ for those who want syntactic sugar, and Genie is just an alternative syntax for Vala. It makes writing GObject C a pleasure by not having to actually write GObject C.

Tag summary

Content type

Image

Digest

Size

2 GB

Last updated

over 6 years ago

docker pull mdegans/nvalhalla:latest-tegra