I'm building a computer vision application using Python (OpenCV, keras-retinanet, tensorflow) which requires detecting an object and then counting how many objects are behind that front object. So, objects are often overlapping.

For example: How many are in this queue?

Here, the aim is to detect the person in the front (foreground) of the queue, and then detect the amount of people behind the front person, despite those behind being obscured.

I have built an object recognition model using keras-retinanet to find the object in the foreground, but now I need to count how many are behind that object. My training data is thousands of images of objects ins straight lines, similar to the image linked above.

However, I have been unable to find a viable way to count the objects behind the front object when they are partially obscured (the rest of the people in the queue).

So far I have tried counting edges (using auto-thresholding), lowering the confidence threshold of my object detection model, and training a new object detection model using only obscured objects as training. These methods have all had very low accuracy.

Do you have any advice or direction on how I can attack this problem?


You can try CSRNet model. The "official" repo is here.

There are a number of other implementations floating around GitHub.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.