How can I construct the multi-sources-vs-multi-models stream?

Multiple rtsp sources will  compute with multiple algrithm models.  The  relation between them is multi-vs-multi.  Is there any reference examples or  solution? 
 Appreciate for your replies!

Hi,
You can refer to

This way is not sufficient to multi-vs-multi relation. I have find a solution. Every rtsp constructs a pipeline . And every model constructs a pipeliine. Then rtsp pipelines and model pipelines are linked by “appsink” elements pushing buffer to “appsrc” elements.