Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Inconsistent results in DNN - image gets different detections

Hi all,

I'm having inconsistent results when detecting a cat through OpenCV version 3.3.1 using DNN. I'll explain:

I have two frames, one one with a cat and the without a cat. I've gotten some detection source from PyImageSearch to detect my cat in these frames. However, the detection sometimes is inconsistent. With this I mean that if I first detect frame-without-cat and then frame-with-cat, I get the expected result (no cat found, cat found). However, if I first detect frame-with-cat and then frame-without-cat, I get wrong results (cat detected, cat detected). If I then process frame-without-cat -> frame-with-cat -> frame-without-cat I get the following results: cat not detected, cat detected, cat detected.

I fear that I am either having a memory-overlap issue, or that net.forward() works different from what I expect it to do. However, I have multiple other test-files which do not have this issue, I think about 5% do however so it's still quite a bit.

This is the source I'm working on so far: http://ibibe.nl/opencv/detect-images.py

Anyone who can shed a light on what's going on? I'm really looking forward to your answers.

(Little background information: I'm trying to use OpenCV DNN to detect whether my cat is going inside or outside, so I'm detecting frames whether they contain a cat and specifically where they contain a cat, so that I can determine direction)