Customization in Metropolis microservices example application

This is a follow-up post from original post.

Briefly, we have a YoloV7 model that was trained on some custom data to detect different kinds of artefacts of a bottle. We are using Metropolis microservices spcecifically we’re using the sample pipeline provided in the Quick Start guide to create our application. The input to DeepStream is a sample video of bottles moving on a conveyor belt. (Refer above linked post for image.)

We want to add a post processing step using a custom script that takes in the inference data from our Yolo model and then does a binary classification on each bottle. Can you please help with the following:

  1. How can we consume the DeepStream output in a custom script? Do we read it from Redis? Where can we find the schema for the DeepStream output?
  2. How should the custom script be written so that we can overlay our binary classification bbox on the original stream and output it as an RTSP stream to be viewed in the VST web UI.
  3. We would also like to integrate the custom script’s meta-data output with the analytics service so that it we can setup a tripwire and count the classification done by the post processing step instead of the DeepStream output. What would the required steps look like to accomplish this?

Is your classification on ONNX model? If so, you can put it in the SGIE of DeepStream pipeline.
If your classification can’t be integrated into SGIE, maybe you can all your classification API in the DeepStream application in probe function. Add the classification result into DeepStream metadata.
Unfortunitely, the source code of DeepStream application in MMJ hasn’t released yet. But we will release it in the next release.

Our binary classification is not based on any machine/deep learning model we use some custom logic to do the classification. Is there a way to insert this logic without changing the current DeepStream codebase? Our proposed changes are listed above, we basically want to consume the DeepStream output/meta-data in a custom script, process the data and create our own output meta-data & RTSP stream which can be consumed by the analytics service for counting and VST web UI for viewing respectively. Can you please help with the following:
1) Where can we find the schema for the DeepStream meta-data output?
2) How can we configure the analytics service to consume the meta-data coming from our custom script instead of the DeepStream meta-data?

DeepStream metadata will send to Redis. Can you check the metadate with Redis by refer this topic: How can I get fast streamming from Nvidia metropolis - Intelligent Video Analytics / Metropolis Microservices for Jetson - NVIDIA Developer Forums. Please set the --redis_stream to ‘test’ and use the default --redis_port
Analytics also get metadata from Redis. You also can send your metedata to Redis, so Analytics can use you customised metadata.