Coder Social home page Coder Social logo

dust-rec_realtime's Introduction

Savant module template

This sample is intended to help users to start developing a custom Savant module. It provides:

  • A module with a simple pipeline that includes basic Savant elements and dev features.
  • Scripts with pyfunc and drawfunc templates.
  • A script demonstrating basic Client SDK usage.
  • Easy dev environment setup with either Docker Compose or devcontainer configuration files.
  • Jaeger tracing platform service that allows to collect and inspect module's pipeline traces.
  • Supporting Savant services such as Always On Sink adapter and Uri Input script that allow to send a video to the module and receive stream output.
  • All of the above is setup to be ready to run, with no additional configuration needed.

See documentation for more information.

Development Quick Start

Instructions below assume current platform is x86 and current directory is template.

In case the template sample was copied into custom directory, devcontainer.json config will need to be updated. E.g. directory name is my-module, then

  1. Update --network value in runArgs
"runArgs": [ "--gpus=all", "--network=my-module_network" ],
  1. Update zmq sockets volume source in mounts
{
    "source": "my-module_zmq_sockets",
    "target": "/tmp/zmq-sockets",
    "type": "volume"
},

Subsections below describe alternative ways to realize the general development workflow:

  1. Start jaeger and module processes
  2. The client sends input image to the module and receives module results (image, metadata, logs)
  3. Uri Input script + Always On sink allow to send a video file to be processed by the module and receive a stream output
  4. Changes in pyfuncs, drawfunc, pre- and postprocessing code are loaded at runtime when module receives input from the client
  5. Changes in module configuration require module container restart
  6. Changes in module docker image, e.g. changes in requirements.txt, require module image rebuild

First time start

Note that starting module for the first time involves downloading the model files and building TRT engine which may take several minutes. Additionally, client's wait for module status has a timeout which may be exceeded if TRT engine build process takes long enough. Wait for TRT build finish and restart the client script if so.

Download sample video

URI-Input script demonstration requires a sample video.

curl -o assets/test_data/elon_musk_perf.mp4 https://eu-central-1.linodeobjects.com/savant-data/demo/elon_musk_perf.mp4

Docker Compose

  1. Start Jaeger container
docker compose -f docker-compose.x86.yml up jaeger -d

This is required by the sample module since it is configured to use Jaeger telemetry.

Visit http://127.0.0.1:16686 to access the Jaeger UI.

  1. Start module container
docker compose -f docker-compose.x86.yml up module -d
  1. Run and re-run the client script (result image written into src/output directory)
docker compose -f docker-compose.x86.yml up client
  1. Send a video to the module and receive stream output

Start Always On Sink container

docker compose -f docker-compose.x86.yml up always-on-sink -d

Start Uri Input container

docker compose -f docker-compose.x86.yml up uri-input

Open rtsp://127.0.0.1:554/stream in your player, or visit http://127.0.0.1:888/stream/ in a browser.

  1. Restart module container

E.g., in case module.yml was modified.

docker compose -f docker-compose.x86.yml restart module
  1. Rebuild module image (optionally, use --no-cache and --pull flags for docker build to force full rebuild)

E.g., in case Dockerfile.x86 or requirements.txt were modified.

docker compose -f docker-compose.x86.yml down module
docker compose -f docker-compose.x86.yml build module

VS Code dev container

  1. Open the module directory on host in IDE

File -> Open Folder -> enter path

  1. Start Jaeger container
docker compose -f docker-compose.x86.yml up jaeger -d

This is required by the sample module since it is configured to use Jaeger telemetry.

Visit http://127.0.0.1:16686 to access the Jaeger UI.

  1. Reopen the directory in dev container

Command Palette (F1) -> "Dev Containers: Reopen in container" -> Select devcontainer.json appropriate for the platform

  1. Start and restart module
python module/run.py
  1. Run and re-run the client script (result image written into /opt/savant/src/output directory)
python client/run.py
  1. Send a video to the module and receive stream output

Open the module directory on host, start Always On Sink container

docker compose -f docker-compose.x86.yml up always-on-sink -d

Run URI Input script inside the dev container

cd /opt/savant
python scripts/uri-input.py /test_data/elon_musk_perf.mp4 --socket pub+connect:ipc:///tmp/zmq-sockets/input-video.ipc --sync

Open rtsp://127.0.0.1:554/stream in your player, or visit http://127.0.0.1:888/stream/ in a browser.

  1. Rebuild module image

E.g., in case Dockerfile.x86 or requirements.txt were modified.

Command Palette (F1) -> "Dev Containers: Rebuild container"

Run all project, without main module

docker compose up

dust-rec_realtime's People

Contributors

paaangk avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.