Pass in your image with red dots, and the red dots will be counted by the ML-counting thing just fine. It's a minor variation in approach to solving the problem, and that's OK: When confronted with a problem, people often jump to specific solutions too quickly, and miss out on better or more general approaches. This is quite pertinent in this specific case, as well - you can ask the ML-counting thing to count the rectangles instead of the dots, and perhaps save yourself all the clicking in the first place.