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 occluded.
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 occluded (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 occluded 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?