CountEx: Fine-Grained Counting via Exemplars and Exclusion
Abstract
This paper presents CountEx, a discriminative visual count-ing framework designed to address a key limitation of existing prompt-based methods: the inability to explicitly exclude visually similar distrac-tors. While current approaches allow users to specify what to count viainclusion prompts, they often struggle in cluttered scenes with confus-able object categories, leading to ambiguity and overcounting. CountExenables users to express both inclusion and exclusion intent, specifyingwhat to count and what to ignore, through multimodal prompts includ-ing natural language descriptions and optional visual exemplars. At thecore of CountEx is a novel Discriminative Query Refinement module,which jointly reasons over inclusion and exclusion cues by first identi-fying shared visual features, then isolating exclusion-specific patterns,and finally applying selective suppression to refine the counting query.To support systematic evaluation of fine-grained counting methods, weintroduce CoCount, a benchmark comprising 1,780 videos and 10,086 an-notated frames across 97 category pairs. Experiments show that Coun-tEx achieves substantial improvements over state-of-the-art methods forcounting objects from both known and novel categories. The data, code,and model are available at https://github.com/bbvisual/CountEx.