Skip to content

TrafficAnalytics

Identifies traffic objects for use with sensors such as presence, counts, etc.

Current Classes

- Bicycle
- Bus
- Car
- Motorbike
- Truck

How to Use

This pipeline mainly supports processing an input video file. It is broken up into several sub-pipeline files, but the main executable is the TrafficAnalyticsFile.yaml file.

./bin/runPipeline share/pipelines/TrafficAnalytics/TrafficAnalyticsFile.yaml VIDEO_IN=<path to video file>

Running RTSP feed with TrafficAnalyticsRTSP.yaml

./bin/runPipeline share/pipelines/TrafficAnalytics/TrafficAnalyticsRTSP.yaml VIDEO_IN=<path RTSP feed>

Output

The main use of this pipeline is to generate a JSON output via AMQP to other microservices. Example of output here The file pipeline also has an option to render a video output with the generate boxes, labels, and tracker data

Pipeline Parameters

Below is a breakdown of all the available options for the main and each sub-pipeline.

TrafficAnalytics.yaml

Option Name Expected Type Available Options Notes
frameInput sio::Mat<sio::Vec3b, 2> Can ingest video files, RTSP streams, any previously converted frames
gpuDevice integer [ 1, (num of GPUS) ] Index of GPU to use
detectionModel std::string Detection Models Select model to use for object detection
boxFilterType std::string Box Filters Select method for filtering boxes
enabledClasses std::List<std::string> Available Classes List of classes enabled in the object detector
boxFilterClasses std::List<std::string> Available Classes List of classes to use for filtering BBoxes
boxFilterMin std::List<float> [ 0, (Input Size of Model) ] List of floats in same length of filter classes. Represent minimum box sizes
boxFilterMax std::List<float> [ 0, (Input Size of Model) ] List of floats in same length of filter classes. Maximum BBox size, zero is no max
boxFilterROI std::List<std::List<int>> [ [], (List of regions) ] List of regions where each region defined using [ x, y, w, h ], either absolute pixel coordinates or relative to the size of the image, with each value being in range of [0,1]
boxFilterROIMethod std::string 'boxInRoi, roiInBox' Method to apply box filter ROI. boxInRoi or roiInBox. The former will require full containment of bounding box in ROI to pass, the latter will require full containment of ROI in bounding box to pass. Can also be specified with a percentage: for example boxInRoi75 will require that at least 75% of box area is within ROI to pass
detectionMinConfidence float [0, 1.0] Float value representing minimum confidence threshold for filtering BBoxes
detectionOverlapThreshold float [0.0-1.0] Parameter to help with filtering detection that have bounding boxes overlapping at least that much. Default: 0.8
useTracker boolean (true, false) Choose whether or not to use object tracking. Frame skipping is not enable, so performance hit is high
trackerType std::string 'cpuBest, cpuFast, cpuFaster, cpuFastest' Choose the tracker algorithm to use. Select from the given string names to choose the speed/accuracy of the tracker cpuFaster is currently in a really un-optimized state and is very slow on high-res images, don't use
sourceId std::string Any string ID to tag pipeline where results are originating from
saveJSON boolean (true, false) Debug option for creating an output JSON of the encoded data heading to AMQP integration
updateOnImprovedScore boolean (true, false) Option to choose whether to mark an object updated if its score has improved
imageSaveDir std::string PATH If set, images will be saved to this directory. If not, no image output will occur
imageWriterFormat std::string extension If set, images will be saved in the specified format ex. (png, jpg)
imageSaveFrequencyMs integer milliseconds Frequency in which to save images to the previously set directory
amqpUseSsl boolean (true, false) Choose to use SSL certificates or not with connection
amqpHost std::string IP Address "127.0.0.1" IP Address to the AMQP host
amqpPort integer IE: 5672 Port number used to communicate AMQP information
amqpUser std::string "<username>" Username to use for AMQP credentials
amqpPassword std::string "<password>" Password to use for AMQP credentials
amqpMaxRetries integer Integer typically between [1-5] Number of retries before ending AMQP connection
amqpExchange std::string Any string Exchange topic
amqpRoutingKey std::string Any string Routing topic
amqpErrorOnFailure boolean (true, false) asd
performanceInfo boolean (true, false) Set to true, SIO performance monitor will output logging info to the console
includeAverageHardware boolean (true, false) Set to true, SIO performance monitor log average hardware usage statistics
performanceCSVFile std::string (true, false) Set to true, SIO performance monitor save logging statistics to this file name
updateOnlyOnChange boolean (true, false) If true, only emit new or updated detections (that includes previously detected objects with an improved score). Default: true
updateFilterUnchangedObjects boolean (true, false) If false, the objects in the frame that haven't been updated are no longer removed from the JSON output, even if updateOnlyOnChange=true. Default: true
updateMinFrequencyMs boolean (true, false) Force updates when enough time has passed even if no changes
updateAllowEmptyJSON boolean (true, false) Emit JSON even when no objects are present. When set to false, no results will be published on AMQP, when empty.
updateResetStateOnNewInput boolean (true, false) Relevant for FolderWatch pipeline only; if true, treat each new input as a separate stream.
updateOnMetaclassCountChange std::string Comma-separated list of metaclasses Metaclasses which will trigger update on change of object counts in report
updateOnStart boolean (true, false) Send framedata update on the first frame, even if empty
debugRawResultsPrefix std::string PATH + Prefix Set to path + prefix to enable raw detection output dumping. Debug only, not for field/production deployment.
sensorsConfigFile std::string PATH Event analytics configuration file path
jsonDumpFormat std::string 'json' or 'csv' Save format for output JSONs. Default: 'json'.
debugOutputPath std::string PATH Save path for debug files. Default: '/data/tmp'
extensionModules std::string Comma-separated list of modules comma-separated list of file paths pointing to Python modules to be used, in order specified, to post-process and potentially modify the JSON output emitted by the pipeline. Default: ''
extensionConfigurations std::string Comma-separated list of modules comma-separated list of file paths pointing to Python modules to be used, in order specified, to post-process and potentially modify the JSON output emitted by the pipeline. Default: ''

TrafficAnalyticsGstFile

All TrafficAnalytics options are available, plus:

Option Name Expected Type Available Options Notes
VIDEO_IN path to video file <path to file>.mp4 Select video file to use for processing. Currently supports a single file

TrafficAnalyticsFile

All TrafficAnalytics options are available, plus:

Option Name Expected Type Available Options Notes
VIDEO_IN path to video file <path to file>.mp4 Select video file to use for processing. Currently supports a single file
renderVideo bool (true, false) Select whether or not to output a rendered video output. If true, a video will be saved in the directory the pipeline was run
renderVideoOut std::string "*.mp4" Default behavior is to output a file to "render-out.mp4"

TrafficAnalyticsRTSP

All TrafficAnalytics options are available, plus:

Option Name Expected Type Available Options Notes
VIDEO_IN url to video stream rtsp://<path to stream> Select video file to use for processing.
resizeToSize integer Integers roughly between [360-1080] Resize incoming RTSP image to this horizontal width
fpsLimit integer Usually somewhere between [1-60] Adjust the max fps limit for processing of incoming frames from the target RTSP stream
maxQueueSize integer Usually somewhere between [0-200] Maximum frames to hold in the frame queue. 0 disables asynchronous reading
hardwareDecoderType std::string "none" or "" Hardware decoder device. 'none' to disable, empty for system default
recordTo std::string Path or empty string Folder to record the incoming video to. Default: '' (recording disabled)
recordInterval int Recommended > 3000 Interval, in milliseconds, after which a new file will be opened for a recording (may take longer, depending on I-frame. Default: 5000
rtspTimeoutMs int Usually somewhere between [1000-10000] RTSP timeout in milliseconds. Default: 5000
rtspRetryCount int Usually somewhere between [1-5] Number of time RTSP connection will be retried before giving up. Default: 3