|
| 1 | +# Advanced Inference Pipelies |
| 2 | +This page documents the following "Advance Inference Pipelines" consiting of |
| 3 | +* [Parallel Inference on Selective Streams](#parallel-inference-on-selective-streams) |
| 4 | +* [Multiple Pipelines Running in Their Own Thread](#multiple-pipelines-running-in-their-own-thread) |
| 5 | +* [Multiple Pipelines with Interpipe Source listening to Pipeline with InterpipeSink](#multiple-pipelines-with-interpipe-source-listening-to-pipeline-with-interpipe-sink) |
| 6 | +* [Single Pipeline with Interpipe Source switching between Multiple Pipelines/Sinks](#single-pipeline-with-interpipe-source-switching-between-multiple-pipelinessinks) |
| 7 | + |
| 8 | +<br> |
| 9 | + |
| 10 | +--- |
| 11 | + |
| 12 | +### Parallel Inference on Selective Streams |
| 13 | + |
| 14 | +* [`parallel_inference_on_selective_streams.py`](/examples/python/parallel_inference_on_selective_streams.py) |
| 15 | +* [`parallel_inference_on_selective_streams.cpp`](/examples/cpp/parallel_inference_on_selective_streams.cpp) |
| 16 | + |
| 17 | +```python |
| 18 | +# |
| 19 | +# This example shows how to use a Remuxer Component to create parallel branches, |
| 20 | +# each with their own Inference Components (Preprocessors, Inference Engines, |
| 21 | +# Trackers, for example). |
| 22 | +# IMPORTANT! All branches are (currently) using the same model engine and config. |
| 23 | +# files, which is not a valid use case. The actual inference components and |
| 24 | +# models to use for any specific use cases is beyond the scope of this example. |
| 25 | +# |
| 26 | +# Each Branch added to the Remuxer can specify which streams to process or |
| 27 | +# to process all. Use the Remuxer "branch-add-to" service to add to specific streams. |
| 28 | +# |
| 29 | +# stream_ids = [0,1] |
| 30 | +# dsl_remuxer_branch_add_to('my-remuxer', 'my-branch-0', |
| 31 | +# stream_ids, len[stream_ids]) |
| 32 | +# |
| 33 | +# You can use the "branch-add" service if adding to all streams |
| 34 | +# |
| 35 | +# dsl_remuxer_branch_add('my-remuxer', 'my-branch-0') |
| 36 | +# |
| 37 | +# In this example, 4 RTSP Sources are added to the Pipeline: |
| 38 | +# - branch-1 will process streams [0,1] |
| 39 | +# - branch-2 will process streams [1,2] |
| 40 | +# - branch-3 will process streams [0,2,3] |
| 41 | +# |
| 42 | +# Three ODE Instance Triggers are created to trigger on new object instances |
| 43 | +# events (i.e. new tracker ids). Each is filtering on a unique class-i |
| 44 | +# (vehicle, person, and bicycle). |
| 45 | +# |
| 46 | +# The ODE Triggers are added to an ODE Handler which is added to the src-pad |
| 47 | +# (output) of the Remuxer. |
| 48 | +# |
| 49 | +# A single ODE Print Action is created and added to each Trigger (shared action). |
| 50 | +# Using multiple Print Actions running in parallel -- each writing to the same |
| 51 | +# stdout buffer -- will result in the printed data appearing interlaced. A single |
| 52 | +# Action with an internal mutex will protect from stdout buffer reentrancy. |
| 53 | +# |
| 54 | + |
| 55 | +``` |
| 56 | + |
| 57 | +<br> |
| 58 | + |
| 59 | +--- |
| 60 | + |
| 61 | +### Multiple Pipelines Running in Their Own Thread |
| 62 | + |
| 63 | +* [`multiple_pipelines.py`](/examples/python/multiple_pipelines.py) |
| 64 | +* [`multiple_pipelines.cpp`](/examples/cpp/multiple_pipelines.cpp) |
| 65 | + |
| 66 | +```python |
| 67 | +# |
| 68 | +# This example demonstrates how to run multple Pipelines, each in their own |
| 69 | +# thread, and each with their own main-context and main-loop. |
| 70 | +# |
| 71 | +# After creating and starting each Pipelines, the script joins each of the |
| 72 | +# threads waiting for them to complete - either by EOS message, 'Q' key, or |
| 73 | +# Delete Window. |
| 74 | +# |
| 75 | +``` |
| 76 | + |
| 77 | +<br> |
| 78 | + |
| 79 | +--- |
| 80 | + |
| 81 | +### Multiple Pipelines with Interpipe Source listening to Pipeline with Interpipe Sink |
| 82 | + |
| 83 | +* [`interpipe_multiple_pipelines_listening_to_single_sink.py`](/examples/python/interpipe_multiple_pipelines_listening_to_single_sink.py) |
| 84 | +* [`interpipe_multiple_pipelines_listening_to_single_sink.cpp`](/examples/cpp/interpipe_multiple_pipelines_listening_to_single_sink.cpp) |
| 85 | + |
| 86 | +```python |
| 87 | +# |
| 88 | +# This script demonstrates how to run multple Pipelines, each with an Interpipe |
| 89 | +# Source, both listening to the same Interpipe Sink. |
| 90 | +# |
| 91 | +# A single Player is created with a File Source and Interpipe Sink. Two Inference |
| 92 | +# Pipelines are created to listen to the single Player - shared input stream. |
| 93 | +# The two Pipelines can be created with different configs, models, and/or Trackers |
| 94 | +# for side-by-side comparison. Both Pipelines run in their own main-loop with their |
| 95 | +# own main-context, and have their own Window Sink for viewing and external control. |
| 96 | +# |
| 97 | +``` |
| 98 | +<br> |
| 99 | + |
| 100 | +--- |
| 101 | + |
| 102 | +### Single Pipeline with Interpipe Source switching between Multiple Pipelines/Sinks |
| 103 | + |
| 104 | +* [`interpipe_single_pipeline_dynamic_switching_between_multiple_sinks.py`](/examples/python/interpipe_single_pipeline_dynamic_switching_between_multiple_sinks.py) |
| 105 | +* [`interpipe_single_pipeline_dynamic_switching_between_multiple_sinks.cpp`](/examples/cpp/interpipe_single_pipeline_dynamic_switching_between_multiple_sinks.cpp) |
| 106 | + |
| 107 | +```python |
| 108 | +# ------------------------------------------------------------------------------------ |
| 109 | +# This example demonstrates interpipe dynamic switching. Four DSL Players |
| 110 | +# are created, each with a File Source and Interpipe Sink. A single |
| 111 | +# inference Pipeline with an Interpipe Source is created as the single listener |
| 112 | +# |
| 113 | +# The Interpipe Source's "listen_to" setting is updated based on keyboard input. |
| 114 | +# The xwindow_key_event_handler (see below) is added to the Pipeline's Window Sink. |
| 115 | +# The handler, on key release, sets the "listen_to" setting to the Interpipe Sink |
| 116 | +# name that corresponds to the key value - 1 through 4. |
| 117 | +``` |
| 118 | + |
0 commit comments