Repository: opencv
Issue: net.forward() returns always the same result after some successful passes (only happens with cuda enabled dnn)
Labels: bug,category: gpu/cuda (contrib),category: dnn

<!--
If you have a question rather than reporting a bug please go to https://forum.opencv.org where you get much faster responses.
If you need further assistance please read [How To Contribute](https://github.com/opencv/opencv/wiki/How_to_contribute).

This is a template helping you to create an issue which can be processed as quickly as possible. This is the bug reporting section for the OpenCV library.
-->

##### System information (version)
<!-- Example
- OpenCV => 4.2
- Operating System / Platform => Windows 64 Bit
- Compiler => Visual Studio 2017
-->

- OpenCV => 4.5.3
- Operating System / Platform => Ubuntu 20.04 / x64
- Compiler => :grey_question:

##### Detailed description

Hi, after processing a few frames with the cuda/cudnn backend, the net.forward() pass will start returning the same exact results despite that I’m feeding it different blobs every time. 

Some sidenotes on this:

1. it only happens when using cuda enabled version of cv compiled from source with CUDA and CUDNN enabled. CUDA version is 11.2 and CUDNN version 8.1.0. I picked these versions because I have the very same version of the software running in an identical machine somewhere else, and I’m not seeing the problem there.

2. this odd behavior does NOT happen when using python-opencv installed via pip … it will always work as expected.

3. the net has been loaded with cv2.dnn.readFromDarknet and works fine for a second or two, then net.forward starts returning always the same values.

4.  the very same project runs without presenting any problem on an identical machine: same motherboard, same cpu, same amount of memory, both with ubuntu 20.04, cuda 11.2, and cudnn 8.1.0, opencv compiled to use cuda+cudnn on both of them (same versions), with the same compute capabilites compiled (6.1 and 8.6). The only difference that I can think of is that the machine where it works has two GPUs (a 1080 ti and a 3090) versus a single 1080 ti on the one that’s presenting the issue.

I spent days debugging the code assuming that I had messed something up with my pipeline, up to the point where I hash and save to disk every frame that I pass to the net.setInput() and I can confirm that I’m passing new fresh frames to it, only to get always the same exact result from net.forward(). If you ask me, it would seem like a bug somewhere when using the cuda 
enabled dnn.

My guess: It could be that net.setInput(blob) failed … such failure could probably explain why I’m getting always the same outputs for the net.forward. Now, is this even possible? For the net.setInput() call to fail? If that's not the procedure that's failing, maybe it's just something odd going on inside the forward pass, resulting in returning always the same values (from the last successful pass). Maybe crashing somewhere and instead of raising an error, returning silently the output nodes which havent been updated yet, thus returning the same values over and over.

##### Steps to reproduce

I have no idea how to make this reproducible for everyone, as it only happens after a few seconds of processing (or after 20, 30 or 40 frames) and it only happens on one machine ... I have another computer with the exact same configuration and it doesn't fail there. 

In the below logs, you will see the outputs as they come from the net.forward() call ... and also the frame that produced such output. You will see that up to a certain point, for each different frame produces a different output ... after which despite whatever frame i feed it, it will always return the same outputs, with the same confidences, bouding boxes, etc.

You may think that maybe the frames that I'm feeding are wrong, that may I lost control somewhere in my pipeline, and that I'm always feeding the same frames, so that could explain why the outputs are all the same. However, that is not the case. The frames are indeed unique, and fresh, and that can be seen represented in their naming scheme, that is as follows:

{}_{}_{}x{}x{}.format(id(frame), hashlib.md5(frame.tobytes()), frame.shape[0], frame.shape[1], frame.shape[2])

if the second term of the frame name (as they appear on the logs) is different amongst different frames, they are indeed different frames. My point: they are different frames and they are producing the same results from the forward pass. My guess: the forward pass is not executing and its just returning the output from the last valid forward pass.

LOGS:

<details>

### FRAME 1, THE NETWORK OUTPUT AFTER THE FORWARD PASS IS FINE

 2021-08-17 19:46:40,290 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.2071870118379593** frame=**140145163254400_ee07a9ee9d0ad35ff7784386e69704f3_972x1862x3** drawed_frame=140145163253840_047bcaa2d78401358572270804c66061_1080x1920x3 top=152 bottom=202 left=1184 right=1214 
 2021-08-17 19:46:40,290 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: new winner person is valid ... and will be muted for 10 seconds ... 
 2021-08-17 19:46:40,290 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: inside active hours ... 
 2021-08-17 19:46:40,290 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: meets condition ... action will be executed. 
 2021-08-17 19:46:40,291 [WARNING] threadId=140142784276224 threadName=Thread-1 actions.mail_action.MailAction: creating logger actions.mail_action.MailAction 
 2021-08-17 19:46:40,291 [INFO] threadId=140142784276224 threadName=Thread-1 actions.mail_action.MailAction: sending mail ... 
 2021-08-17 19:46:40,373 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140146384640192 outputs=[array([[0.04184121, 0.05668405, 0.38320693, ..., 0.        , 0.        ,
         0.        ],
        [0.0433972 , 0.03311229, 0.34516552, ..., 0.        , 0.        ,
         0.        ],
        [0.0433401 , 0.03884519, 0.800014  , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9571854 , 0.9445724 , 0.34035212, ..., 0.        , 0.        ,
         0.        ],
        [0.963993  , 0.9650332 , 0.30209535, ..., 0.        , 0.        ,
         0.        ],
        [0.9707502 , 0.9675642 , 0.8351957 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.02003189, 0.02386065, 0.05294199, ..., 0.        , 0.        ,
         0.        ],
        [0.0212706 , 0.02125368, 0.3885152 , ..., 0.        , 0.        ,
         0.        ],
        [0.02433814, 0.01654862, 0.07879346, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.97393245, 0.97497237, 0.04806911, ..., 0.        , 0.        ,
         0.        ],
        [0.9795605 , 0.9751602 , 0.31552503, ..., 0.        , 0.        ,
         0.        ],
        [0.9786032 , 0.98283106, 0.0768373 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00989129, 0.00553594, 0.01460223, ..., 0.        , 0.        ,
         0.        ],
        [0.01037657, 0.0109085 , 0.0222752 , ..., 0.        , 0.        ,
         0.        ],
        [0.01025952, 0.00885574, 0.16126595, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98951   , 0.99048036, 0.01790972, ..., 0.        , 0.        ,
         0.        ],
        [0.9895224 , 0.9871154 , 0.0205368 , ..., 0.        , 0.        ,
         0.        ],
        [0.9877222 , 0.9898594 , 0.15524755, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 

### FRAME 2. SAME, ALL GOOD

 2021-08-17 19:46:40,503 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.24684207141399384** frame=**140145172116384_3cdf04d1c352dd315bfb4940da652db9_972x1862x3** drawed_frame=140148269073392_6e9444f053c60041cf76a0569485e6a9_1080x1920x3 top=154 bottom=204 left=1195 right=1223 
 2021-08-17 19:46:40,573 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140148269059328 outputs=[array([[0.04147722, 0.05627713, 0.36787164, ..., 0.        , 0.        ,
         0.        ],
        [0.04333243, 0.033227  , 0.34109682, ..., 0.        , 0.        ,
         0.        ],
        [0.04326073, 0.03888976, 0.7962468 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.95317197, 0.9412474 , 0.29615876, ..., 0.        , 0.        ,
         0.        ],
        [0.9624225 , 0.96328056, 0.2914532 , ..., 0.        , 0.        ,
         0.        ],
        [0.9719641 , 0.9667753 , 0.8100631 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01998937, 0.02387588, 0.05316097, ..., 0.        , 0.        ,
         0.        ],
        [0.02125433, 0.02112673, 0.38205495, ..., 0.        , 0.        ,
         0.        ],
        [0.02455969, 0.01640156, 0.0794144 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.97408205, 0.97498304, 0.04730834, ..., 0.        , 0.        ,
         0.        ],
        [0.9787287 , 0.97493666, 0.31435654, ..., 0.        , 0.        ,
         0.        ],
        [0.97799754, 0.9828626 , 0.07727735, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00983832, 0.00550582, 0.01460496, ..., 0.        , 0.        ,
         0.        ],
        [0.01037426, 0.0108759 , 0.02223426, ..., 0.        , 0.        ,
         0.        ],
        [0.01026009, 0.00882221, 0.16202709, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98977387, 0.9905988 , 0.01693194, ..., 0.        , 0.        ,
         0.        ],
        [0.98963016, 0.98724353, 0.0198305 , ..., 0.        , 0.        ,
         0.        ],
        [0.9876427 , 0.99003637, 0.15573648, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 
 2021-08-17 19:46:40,709 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145172074880 outputs=[array([[0.04144537, 0.05609858, 0.37901554, ..., 0.        , 0.        ,
         0.        ],
        [0.04349962, 0.03338619, 0.34363878, ..., 0.        , 0.        ,
         0.        ],
        [0.04353698, 0.03893685, 0.79313207, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9550059 , 0.9419675 , 0.30991736, ..., 0.        , 0.        ,
         0.        ],
        [0.9630538 , 0.96392655, 0.2940471 , ..., 0.        , 0.        ,
         0.        ],
        [0.97258556, 0.96719855, 0.81742746, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.02004956, 0.02397213, 0.05361598, ..., 0.        , 0.        ,
         0.        ],
        [0.02125663, 0.0212603 , 0.38265717, ..., 0.        , 0.        ,
         0.        ],
        [0.02462588, 0.01641329, 0.07970284, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9740033 , 0.97502655, 0.04728709, ..., 0.        , 0.        ,
         0.        ],
        [0.97909504, 0.97519   , 0.31835037, ..., 0.        , 0.        ,
         0.        ],
        [0.97811556, 0.98308474, 0.07712822, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00985097, 0.00554871, 0.01459973, ..., 0.        , 0.        ,
         0.        ],
        [0.01036054, 0.0109474 , 0.02227647, ..., 0.        , 0.        ,
         0.        ],
        [0.01027794, 0.0088614 , 0.16195817, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.989476  , 0.9904509 , 0.01709388, ..., 0.        , 0.        ,
         0.        ],
        [0.9898342 , 0.9873094 , 0.01971628, ..., 0.        , 0.        ,
         0.        ],
        [0.9878335 , 0.99013114, 0.15834525, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 

### FRAME 3. STILL ALL GOOD.

 2021-08-17 19:46:40,832 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.4165158271789551** frame=**140148269000624_364a0eba09f9aa02c3eed7f48d17c915_972x1862x3** drawed_frame=140145163363952_1bfb77fac1fd66bbe95ae7237bf503a3_1080x1920x3 top=153 bottom=204 left=1210 right=1236 
 2021-08-17 19:46:40,905 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145163314112 outputs=[array([[0.0415148 , 0.05625229, 0.38190243, ..., 0.        , 0.        ,
         0.        ],
        [0.04359939, 0.03344554, 0.3448177 , ..., 0.        , 0.        ,
         0.        ],
        [0.0433911 , 0.03896434, 0.7936731 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9567484 , 0.94384855, 0.32669282, ..., 0.        , 0.        ,
         0.        ],
        [0.9641448 , 0.9647165 , 0.30094734, ..., 0.        , 0.        ,
         0.        ],
        [0.97149   , 0.9673471 , 0.8305816 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01988847, 0.0238387 , 0.05315813, ..., 0.        , 0.        ,
         0.        ],
        [0.02116848, 0.02110317, 0.38690606, ..., 0.        , 0.        ,
         0.        ],
        [0.02450988, 0.01643229, 0.07927735, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9745406 , 0.97554547, 0.04673744, ..., 0.        , 0.        ,
         0.        ],
        [0.9792187 , 0.9754859 , 0.3179132 , ..., 0.        , 0.        ,
         0.        ],
        [0.9785869 , 0.9828373 , 0.07632315, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00982437, 0.00543834, 0.0145965 , ..., 0.        , 0.        ,
         0.        ],
        [0.01034073, 0.01088718, 0.02222765, ..., 0.        , 0.        ,
         0.        ],
        [0.01026161, 0.00879903, 0.16241652, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98969865, 0.9904392 , 0.01695542, ..., 0.        , 0.        ,
         0.        ],
        [0.9899816 , 0.98729813, 0.01941951, ..., 0.        , 0.        ,
         0.        ],
        [0.9878943 , 0.9901751 , 0.15979838, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 

### FRAME 4. STILL ALL GOOD.

 2021-08-17 19:46:41,028 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.26080334186553955** frame=**140148269002304_615d5ee9b4034e8db43559ae3f341f13_972x1862x3** drawed_frame=140148269073792_4f80cbc1f9011291e8bb86a5dda69bae_1080x1920x3 top=155 bottom=201 left=1214 right=1242 
 2021-08-17 19:46:41,102 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145173756992 outputs=[array([[0.04127501, 0.05620699, 0.38672304, ..., 0.        , 0.        ,
         0.        ],
        [0.04345443, 0.03356195, 0.34529188, ..., 0.        , 0.        ,
         0.        ],
        [0.04348753, 0.03904485, 0.79335   , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9566195 , 0.94396174, 0.32422933, ..., 0.        , 0.        ,
         0.        ],
        [0.9643425 , 0.96397454, 0.2990238 , ..., 0.        , 0.        ,
         0.        ],
        [0.97124934, 0.96713877, 0.83032805, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01991102, 0.02377299, 0.05311163, ..., 0.        , 0.        ,
         0.        ],
        [0.02117246, 0.02127104, 0.38346907, ..., 0.        , 0.        ,
         0.        ],
        [0.02437046, 0.01635709, 0.07887881, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9745068 , 0.9755158 , 0.04693944, ..., 0.        , 0.        ,
         0.        ],
        [0.97936594, 0.97550315, 0.31816116, ..., 0.        , 0.        ,
         0.        ],
        [0.97876304, 0.98301196, 0.07635951, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00976367, 0.0054318 , 0.01442219, ..., 0.        , 0.        ,
         0.        ],
        [0.01032234, 0.01093165, 0.02220655, ..., 0.        , 0.        ,
         0.        ],
        [0.0102536 , 0.00882905, 0.16177048, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98974013, 0.9903728 , 0.01697756, ..., 0.        , 0.        ,
         0.        ],
        [0.98988765, 0.9872434 , 0.0194112 , ..., 0.        , 0.        ,
         0.        ],
        [0.9878688 , 0.9901419 , 0.15716612, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 

### FRAME 5. STILL ALL GOOD.

 2021-08-17 19:46:41,223 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.7191081643104553** frame=**140148269000624_b44c0561712627e1122b9538d1845fa7_972x1862x3** drawed_frame=140148269074432_912422d54638a827b5e5221dd98ea20b_1080x1920x3 top=153 bottom=205 left=1215 right=1244 
 2021-08-17 19:46:41,296 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145163370240 outputs=[array([[0.04180452, 0.05583645, 0.38429996, ..., 0.        , 0.        ,
         0.        ],
        [0.04364462, 0.03365762, 0.34307972, ..., 0.        , 0.        ,
         0.        ],
        [0.04313876, 0.03878802, 0.79648477, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9555418 , 0.9437589 , 0.3164644 , ..., 0.        , 0.        ,
         0.        ],
        [0.9633529 , 0.96402156, 0.29384542, ..., 0.        , 0.        ,
         0.        ],
        [0.97118086, 0.9672406 , 0.8182709 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.02012767, 0.02393344, 0.05320252, ..., 0.        , 0.        ,
         0.        ],
        [0.02108649, 0.02162425, 0.38063997, ..., 0.        , 0.        ,
         0.        ],
        [0.02438815, 0.01635473, 0.07934068, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.9749658 , 0.97607714, 0.04553242, ..., 0.        , 0.        ,
         0.        ],
        [0.9797581 , 0.9758941 , 0.32799095, ..., 0.        , 0.        ,
         0.        ],
        [0.9787562 , 0.9827413 , 0.07590232, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00976809, 0.00542139, 0.01449947, ..., 0.        , 0.        ,
         0.        ],
        [0.01037788, 0.01095408, 0.02231537, ..., 0.        , 0.        ,
         0.        ],
        [0.01025988, 0.00886466, 0.16186625, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98971117, 0.9906779 , 0.01701261, ..., 0.        , 0.        ,
         0.        ],
        [0.99004626, 0.9873831 , 0.0190291 , ..., 0.        , 0.        ,
         0.        ],
        [0.9878561 , 0.9903937 , 0.16024606, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 

### FRAME 6. STILL ALL GOOD.

 2021-08-17 19:46:41,415 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.3107437789440155** frame=**140148269002464_47467b7557d228013a2955ba057efeea_972x1862x3** drawed_frame=140145163365232_3d5a1c364119161677681116fe7c0f56_1080x1920x3 top=157 bottom=200 left=1228 right=1254 
 2021-08-17 19:46:41,490 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145172075264 outputs=[array([[0.04182004, 0.05585784, 0.38418928, ..., 0.        , 0.        ,
         0.        ],
        [0.04354559, 0.03365485, 0.34461457, ..., 0.        , 0.        ,
         0.        ],
        [0.04319893, 0.03921814, 0.7940287 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.956159  , 0.9432997 , 0.31980985, ..., 0.        , 0.        ,
         0.        ],
        [0.963658  , 0.9640971 , 0.29550996, ..., 0.        , 0.        ,
         0.        ],
        [0.9712002 , 0.96662915, 0.8237462 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01989705, 0.02376404, 0.05311889, ..., 0.        , 0.        ,
         0.        ],
        [0.02108659, 0.02143419, 0.38552505, ..., 0.        , 0.        ,
         0.        ],
        [0.02437447, 0.01623068, 0.07920057, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.97461516, 0.9760959 , 0.04563966, ..., 0.        , 0.        ,
         0.        ],
        [0.979576  , 0.9758638 , 0.32672307, ..., 0.        , 0.        ,
         0.        ],
        [0.97882   , 0.98273283, 0.07670502, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00982742, 0.00534296, 0.0147017 , ..., 0.        , 0.        ,
         0.        ],
        [0.01040688, 0.01082712, 0.02230135, ..., 0.        , 0.        ,
         0.        ],
        [0.01025584, 0.00876109, 0.1628956 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98968035, 0.99055827, 0.01665598, ..., 0.        , 0.        ,
         0.        ],
        [0.99028486, 0.9874511 , 0.01885051, ..., 0.        , 0.        ,
         0.        ],
        [0.9878053 , 0.9904643 , 0.16308843, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 

### FRAME 7. STILL ALL GOOD. BUT PLEASE NOTE THAT THIS FRAME IS THE FIRST ONE THAT RETURNS A CONFIDENCE OF EXACTLY 0.6169877052307129 ...

 2021-08-17 19:46:41,617 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.6169877052307129** frame=**140148269002304_fa7e108b9452f5dc5007a833b69660f0_972x1862x3** drawed_frame=140148269074032_9b3b4515ba243be15f1110ee3f7bdaf1_1080x1920x3 top=154 bottom=201 left=1233 right=1257 
 2021-08-17 19:46:41,747 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140148268535360 outputs=[array([[0.04182004, 0.05585784, 0.38418928, ..., 0.        , 0.        ,
         0.        ],
        [0.04354559, 0.03365485, 0.34461457, ..., 0.        , 0.        ,
         0.        ],
        [0.04319893, 0.03921814, 0.7940287 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.956159  , 0.9432997 , 0.31980985, ..., 0.        , 0.        ,
         0.        ],
        [0.963658  , 0.9640971 , 0.29550996, ..., 0.        , 0.        ,
         0.        ],
        [0.9712002 , 0.96662915, 0.8237462 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01989705, 0.02376404, 0.05311889, ..., 0.        , 0.        ,
         0.        ],
        [0.02108659, 0.02143419, 0.38552505, ..., 0.        , 0.        ,
         0.        ],
        [0.02437447, 0.01623068, 0.07920057, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.97461516, 0.9760959 , 0.04563966, ..., 0.        , 0.        ,
         0.        ],
        [0.979576  , 0.9758638 , 0.32672307, ..., 0.        , 0.        ,
         0.        ],
        [0.97882   , 0.98273283, 0.07670502, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00982742, 0.00534296, 0.0147017 , ..., 0.        , 0.        ,
         0.        ],
        [0.01040688, 0.01082712, 0.02230135, ..., 0.        , 0.        ,
         0.        ],
        [0.01025584, 0.00876109, 0.1628956 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98968035, 0.99055827, 0.01665598, ..., 0.        , 0.        ,
         0.        ],
        [0.99028486, 0.9874511 , 0.01885051, ..., 0.        , 0.        ,
         0.        ],
        [0.9878053 , 0.9904643 , 0.16308843, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 

### FRAME 8. THIS FRAME IS THE FIRST ONE TO GET THE RESULT FROM THE LAST FRAME INSTEAD OF ITS OWN RESULT. THIS SHOULD NOT HAVE HAPPENED.

 2021-08-17 19:46:41,872 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.6169877052307129** frame=**140148269100448_183e4dba0ed552fb5513929498bc77e4_972x1862x3** drawed_frame=140148269100768_8b4b3bb04f264c281f4de6f18ee888ae_1080x1920x3 top=154 bottom=201 left=1233 right=1257 
 2021-08-17 19:46:41,954 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145172083456 outputs=[array([[0.04182004, 0.05585784, 0.38418928, ..., 0.        , 0.        ,
         0.        ],
        [0.04354559, 0.03365485, 0.34461457, ..., 0.        , 0.        ,
         0.        ],
        [0.04319893, 0.03921814, 0.7940287 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.956159  , 0.9432997 , 0.31980985, ..., 0.        , 0.        ,
         0.        ],
        [0.963658  , 0.9640971 , 0.29550996, ..., 0.        , 0.        ,
         0.        ],
        [0.9712002 , 0.96662915, 0.8237462 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01989705, 0.02376404, 0.05311889, ..., 0.        , 0.        ,
         0.        ],
        [0.02108659, 0.02143419, 0.38552505, ..., 0.        , 0.        ,
         0.        ],
        [0.02437447, 0.01623068, 0.07920057, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.97461516, 0.9760959 , 0.04563966, ..., 0.        , 0.        ,
         0.        ],
        [0.979576  , 0.9758638 , 0.32672307, ..., 0.        , 0.        ,
         0.        ],
        [0.97882   , 0.98273283, 0.07670502, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00982742, 0.00534296, 0.0147017 , ..., 0.        , 0.        ,
         0.        ],
        [0.01040688, 0.01082712, 0.02230135, ..., 0.        , 0.        ,
         0.        ],
        [0.01025584, 0.00876109, 0.1628956 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98968035, 0.99055827, 0.01665598, ..., 0.        , 0.        ,
         0.        ],
        [0.99028486, 0.9874511 , 0.01885051, ..., 0.        , 0.        ,
         0.        ],
        [0.9878053 , 0.9904643 , 0.16308843, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 


### FRAME 9 AND ON. ALL SUCESIVE FRAMES ALL RECEIVE THE SAME OUTPUT FROM THE NETWORK

 2021-08-17 19:46:42,072 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.6169877052307129** frame=**140148269099328_eeaf77aa5b655b84eb9a2e672cfedc13_972x1862x3** drawed_frame=140148269100128_503e4658ce6528daa747b03286afeb6f_1080x1920x3 top=154 bottom=201 left=1233 right=1257 
 2021-08-17 19:46:42,152 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145173631808 outputs=[array([[0.04182004, 0.05585784, 0.38418928, ..., 0.        , 0.        ,
         0.        ],
        [0.04354559, 0.03365485, 0.34461457, ..., 0.        , 0.        ,
         0.        ],
        [0.04319893, 0.03921814, 0.7940287 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.956159  , 0.9432997 , 0.31980985, ..., 0.        , 0.        ,
         0.        ],
        [0.963658  , 0.9640971 , 0.29550996, ..., 0.        , 0.        ,
         0.        ],
        [0.9712002 , 0.96662915, 0.8237462 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01989705, 0.02376404, 0.05311889, ..., 0.        , 0.        ,
         0.        ],
        [0.02108659, 0.02143419, 0.38552505, ..., 0.        , 0.        ,
         0.        ],
        [0.02437447, 0.01623068, 0.07920057, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.97461516, 0.9760959 , 0.04563966, ..., 0.        , 0.        ,
         0.        ],
        [0.979576  , 0.9758638 , 0.32672307, ..., 0.        , 0.        ,
         0.        ],
        [0.97882   , 0.98273283, 0.07670502, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00982742, 0.00534296, 0.0147017 , ..., 0.        , 0.        ,
         0.        ],
        [0.01040688, 0.01082712, 0.02230135, ..., 0.        , 0.        ,
         0.        ],
        [0.01025584, 0.00876109, 0.1628956 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98968035, 0.99055827, 0.01665598, ..., 0.        , 0.        ,
         0.        ],
        [0.99028486, 0.9874511 , 0.01885051, ..., 0.        , 0.        ,
         0.        ],
        [0.9878053 , 0.9904643 , 0.16308843, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 
 2021-08-17 19:46:42,282 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.6169877052307129** frame=**140148269100608_e4fb3484eaceaf8dbe1805e9efd0087a_972x1862x3** drawed_frame=140145163254640_78f46a957fdb7b8948a35023f5dd76e3_1080x1920x3 top=154 bottom=201 left=1233 right=1257 
 2021-08-17 19:46:42,351 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: id(outputs)=140145183675904 outputs=[array([[0.04182004, 0.05585784, 0.38418928, ..., 0.        , 0.        ,
         0.        ],
        [0.04354559, 0.03365485, 0.34461457, ..., 0.        , 0.        ,
         0.        ],
        [0.04319893, 0.03921814, 0.7940287 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.956159  , 0.9432997 , 0.31980985, ..., 0.        , 0.        ,
         0.        ],
        [0.963658  , 0.9640971 , 0.29550996, ..., 0.        , 0.        ,
         0.        ],
        [0.9712002 , 0.96662915, 0.8237462 , ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.01989705, 0.02376404, 0.05311889, ..., 0.        , 0.        ,
         0.        ],
        [0.02108659, 0.02143419, 0.38552505, ..., 0.        , 0.        ,
         0.        ],
        [0.02437447, 0.01623068, 0.07920057, ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.97461516, 0.9760959 , 0.04563966, ..., 0.        , 0.        ,
         0.        ],
        [0.979576  , 0.9758638 , 0.32672307, ..., 0.        , 0.        ,
         0.        ],
        [0.97882   , 0.98273283, 0.07670502, ..., 0.        , 0.        ,
         0.        ]], dtype=float32), array([[0.00982742, 0.00534296, 0.0147017 , ..., 0.        , 0.        ,
         0.        ],
        [0.01040688, 0.01082712, 0.02230135, ..., 0.        , 0.        ,
         0.        ],
        [0.01025584, 0.00876109, 0.1628956 , ..., 0.        , 0.        ,
         0.        ],
        ...,
        [0.98968035, 0.99055827, 0.01665598, ..., 0.        , 0.        ,
         0.        ],
        [0.99028486, 0.9874511 , 0.01885051, ..., 0.        , 0.        ,
         0.        ],
        [0.9878053 , 0.9904643 , 0.16308843, ..., 0.        , 0.        ,
         0.        ]], dtype=float32)] 
 2021-08-17 19:46:42,476 [INFO] threadId=140146992895744 threadName=ch0 fetch detection.detectors.opencv_darknet_yolov3coco_detector.OpenCvDarknetYoloV3CocoDetector: winner=name=person confidence=**0.6169877052307129** frame=**140148269099408_4ae2bde2fb2946054742ab3287440273_972x1862x3** drawed_frame=140148269099328_686d1999d6224f3a49e7c46c42cd7ff6_1080x1920x3 top=154 bottom=201 left=1233 right=1257 

</details>

##### Issue submission checklist

 - [x] I report the issue, it's not a question
   <!--
   OpenCV team works with forum.opencv.org, Stack Overflow and other communities
   to discuss problems. Tickets with question without real issue statement will be
   closed.
   -->
 - [x] I checked the problem with documentation, FAQ, open issues,
       forum.opencv.org, Stack Overflow, etc and have not found solution
   <!--
   Places to check:
   * OpenCV documentation: https://docs.opencv.org
   * FAQ page: https://github.com/opencv/opencv/wiki/FAQ
   * OpenCV forum: https://forum.opencv.org
   * OpenCV issue tracker: https://github.com/opencv/opencv/issues?q=is%3Aissue
   * Stack Overflow branch: https://stackoverflow.com/questions/tagged/opencv
   -->
 - [x] I updated to latest OpenCV version and the issue is still there
   <!--
   master branch for OpenCV 4.x and 3.4 branch for OpenCV 3.x releases.
   OpenCV team supports only latest release for each branch.
   The ticket is closed, if the problem is not reproduced with modern version.
   -->
 - [ ] There is reproducer code and related data files: videos, images, onnx, etc
   <!--
   The best reproducer -- test case for OpenCV that we can add to the library.
   Recommendations for media files and binary files:
   * Try to reproduce the issue with images and videos in opencv_extra repository
     to reduce attachment size
   * Use PNG for images, if you report some CV related bug, but not image reader
     issue
   * Attach the image as archive to the ticket, if you report some reader issue.
     Image hosting services compress images and it breaks the repro code.
   * Provide ONNX file for some public model or ONNX file with with random weights,
     if you report ONNX parsing or handling issue. Architecture details diagram
     from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
   -->