AIResearch AIResearch
Back to articles
Science

AI Now Counts Objects Like Humans Do

AI finally counts objects like humans do - identifying and counting anything without needing to know what it is first

AI Research
November 14, 2025
3 min read
AI Now Counts Objects Like Humans Do

Imagine trying to count the lenses in a pair of sunglasses without knowing what sunglasses are. Humans can do this effortlessly by recognizing repeating patterns and structures, but machines have consistently struggled with this basic visual task. A new AI system called CountFormer has finally bridged this gap, enabling computers to count objects they've never seen before with human-like accuracy.

The key breakthrough is CountFormer's ability to recognize visual repetition and structural coherence without needing prior knowledge of what objects are. Unlike previous systems that required reference images or text descriptions, CountFormer can look at any scene and identify how objects repeat and organize themselves. This represents a fundamental shift toward truly class-agnostic counting—where machines can count objects regardless of their category.

CountFormer achieves this through a clever combination of existing technologies. The system uses DINOv2, a self-supervised learning model that creates rich visual representations without human labels. These representations capture the essential structure of objects rather than just their semantic meaning. The researchers then added positional embeddings to maintain spatial relationships and used a lightweight decoder to transform these features into density maps that show where objects are located.

The results demonstrate CountFormer's practical effectiveness. On the standard FSC-147 benchmark dataset containing 147 different object categories, CountFormer achieved competitive performance with a test MAE of 17.49 and RMSE of 114.99. More importantly, it showed superior performance in structurally complex scenes where objects have multiple components or intricate patterns. In the sunglasses example mentioned in the paper, CountFormer correctly identified both lenses as belonging to the same object, while previous methods like CounTX mistakenly counted them as separate items.

This advancement matters because it moves AI systems closer to human-like visual understanding. Current object counting systems typically work well only for specific categories they've been trained on, like people or vehicles. CountFormer's class-agnostic approach means it could be deployed in diverse real-world scenarios without retraining—from inventory management in warehouses to wildlife monitoring in conservation areas. The technology could help scientists count cells in medical images, track animal populations in ecological studies, or assist in manufacturing quality control.

However, the system does have limitations. CountFormer struggles with extremely dense scenes where objects are tightly packed with minimal separation, such as piles of Lego pieces. In these cases, individual items blend together, and the system's ability to detect structural boundaries breaks down. The paper shows one example where CountFormer predicted 400 objects when the actual count was 512—a significant undercount caused by the overwhelming repetition and lack of distinguishing features in tightly clustered scenes.

This limitation points to an important direction for future research. The authors suggest that higher-resolution images might help the system detect subtle boundaries and surface variations in these challenging scenarios. While CountFormer handles the vast majority of object counting tasks effectively, its performance in extreme density conditions shows there's still room for improvement in handling the most complex visual environments.

About the Author

Guilherme A.

Guilherme A.

Former dentist (MD) from Brazil, 41 years old, husband, and AI enthusiast. In 2020, he transitioned from a decade-long career in dentistry to pursue his passion for technology, entrepreneurship, and helping others grow.

Connect on LinkedIn