# Secondary detector operates only on detected frames.

**URL:** <https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232>\
**Category:** DeepStream SDK\
**Created:** [October 14, 2019, 2:17pm UTC](https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232 "2019-10-14T14:17:02Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivaishere96](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@sivaishere96](https://forums.developer.nvidia.com/u/sivaishere96)\
**Post date:** [October 14, 2019, 2:17pm UTC](https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232/1 "2019-10-14T14:17:02Z")

</div>

I have a pipeline consisting of two detectors(Yolo) where the ouput of the first detector is the input of the second. I have initialized them as pgie and sgie. While running the first detector alone the fps reaches around 22 fps. However while running the whole pipeline with the secondary detector the fps comes down to 10 fps. This happens even when there are no detections on the pgie. This means that sgie is run even when there is no detections in the primary detector. Is it possible to run inference on the second detector only when there are detections in pgie?

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [October 21, 2019, 6:49am UTC](https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232/2 "2019-10-21T06:49:56Z")

</div>

I think Tracker is used to solve the problem, can you refer [url][https://docs.nvidia.com/metropolis/deepstream/4.0/DeepStream\_Plugin\_Manual.pdf#[{"num"%3A56%2C"gen"%3A0}%2C{"name"%3A"XYZ"}%2C106%2C223%2C0][/url]](https://docs.nvidia.com/metropolis/deepstream/4.0/DeepStream_Plugin_Manual.pdf#%5B%7B%22num%22%3A56%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C106%2C223%2C0%5D%5B/url%5D) section 2.1.

---

<div class="post-metadata">

**Author:** ![ChrisDing](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/chrisding/32/14043_2.png) [@ChrisDing](https://forums.developer.nvidia.com/u/ChrisDing)\
**Post date:** [October 22, 2019, 11:02am UTC](https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232/3 "2019-10-22T11:02:42Z")

</div>

> > This means that sgie is run even when there is no detections in the primary detector.  
> > I think this will not happen.

What’s the batch size of pgie and sgie ?  
Can you share the GPU workload, by command “nvidia-smi dmon” on Tesla platorm ?  
You can try #2 tracker solution to reduce pgie workload, for example “interval=1” for detection(pgie/sgie) means doing inference for 1 frame and then skip next frame.

---

<div class="post-metadata">

**Author:** ![sivaishere96](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@sivaishere96](https://forums.developer.nvidia.com/u/sivaishere96)\
**Post date:** [October 23, 2019, 6:20am UTC](https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232/4 "2019-10-23T06:20:02Z")

</div>

The tracker(Kanade lucas tomasi - KLT) didnt seem to work for my usecase and so I decided to not use it. I am trying to detect relatively smaller objects and so IOU doesnt seem to aid tracking.The interval option seems to work and we are looking up on it as it leads to compromise in the accuracy.

I am working on Jetson Nano and not on a Tesla platform. The corresponding GPU stats (tegrastats) are- “RAM 2989/3956MB (lfb 97x4MB) SWAP 1079/1978MB (cached 18MB) CPU [29%@307,23%@307,24%@307,20%@307] EMC\_FREQ 0% GR3D\_FREQ 90% PLL@31C CPU@34.5C PMIC@100C GPU@33.5C AO@43C thermal@33.25C POM\_5V\_IN 7557/3907 POM\_5V\_GPU 3904/703 POM\_5V\_CPU 378/822”.

We have 2 detectors with batch sizes 1(default) and both are tiny yolo. Can you provide me with some examples of how to use 2 detectors in the pipeline sequentially? Do I need 2 nvosds and nvvidconvs? My total pipeline needs 2 detectors and 1 classifier sequentially.

---

<div class="post-metadata">

**Author:** ![bcao](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/bcao/32/14043_2.png) [@bcao](https://forums.developer.nvidia.com/u/bcao)\
**Post date:** [October 24, 2019, 6:50am UTC](https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232/5 "2019-10-24T06:50:16Z")

</div>

I think you can change the tracker low level lib to select other Tracker algorithm to see if the accuracy is better,  
you can refer Tracker section to learn how to modify the low level lib [https://docs.nvidia.com/metropolis/deepstream/4.0/DeepStream\_Plugin\_Manual.pdf#%5B%7B%22num%22%3A56%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C106%2C223%2C0%5D](https://docs.nvidia.com/metropolis/deepstream/4.0/DeepStream_Plugin_Manual.pdf#%5B%7B%22num%22%3A56%2C%22gen%22%3A0%7D%2C%7B%22name%22%3A%22XYZ%22%7D%2C106%2C223%2C0%5D)

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 12, 2021, 4:18pm UTC](https://forums.developer.nvidia.com/t/secondary-detector-operates-only-on-detected-frames/83232/6 "2021-10-12T16:18:59Z")

</div>

Closed on October 12, 2021, 4:18pm UTC


