Rethinking Object Detection in Retail Stores
- Publication
- AAAI 2021Conference
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@inproceedings{retailproductlocount2021,
title = {{Rethinking Object Detection in Retail Stores}},
author = {Yuanqiang Cai and Longyin Wen and Libo Zhang and Dawei Du and Weiqiang Wang},
year = {2021},
booktitle = {AAAI},
url = {https://doi.org/10.1609/aaai.v35i2.16178},
doi = {10.1609/aaai.v35i2.16178}
}
Walk through the kitchenware section of a home-goods store and you'll see plates on the shelves in stacks, and bowls nested one inside another.
Ask an annotator to draw a box around every single plate and they'll probably give you a look first. A plate in the middle of a stack shows only a thin ring of rim, every plate around it is the same model, and they'd lose count of which one they're boxing.
Even if the boxes did get drawn, a detector would have a hard time learning them. Nearly every modern detector finishes with NMS: when two boxes overlap too much, one of them is deleted. The boxes in a stack of plates overlap almost completely, so once NMS runs, maybe one or two are left.
This paper comes from the Institute of Software at the Chinese Academy of Sciences, the University of Chinese Academy of Sciences, and Longyin Wen and colleagues, then at JD Finance America. Their view is that in scenes like this, the definition of "one box per instance" itself should change.
Problem Definition
The new task the authors propose is called Locount, a blend of the words localization and counting.
If items of the same class occlude each other heavily, with an overlap above 0.5, the whole group gets one minimal enclosing box, labeled with the number of items inside; if there's no heavy occlusion, items are boxed one by one as usual.

The top row shows earlier retail datasets. GroZi-3.2k and Supermarket Produce are for classification; D2S is shot on a clean tabletop, and Freiburg Groceries boxes only two or three products per image; SKU-110K has real shelves, but only one class, so every product is just an "object".
The bottom row is Locount. In the stacked washbasins of (g), the 2, 2, 1, 6 at the box corners are how many washbasins each box holds; the plates in (i) come in a stack of 8 and still get a single box.
This definition ties together two tasks that used to be separate. Object detection has to find the location of every instance; crowd counting only has to estimate the total for the whole image, usually from center points or a density map. Locount wants "where, and how many".
Dataset
The authors shot 50,394 photos at 1920×1080 in 28 stores and apartments, and annotated 140 product classes in 9 categories: baby products, drinks, food, daily chemicals, clothing, electrical appliances, storage, kitchenware, and stationery and sporting goods. That list reads more like a hypermarket or home-goods store than a supermarket of snacks and drinks.
Annotation took 15 annotators, 250 hours each, with several rounds of cross-checking, for a total of more than 1.9 million instances. The training set has 34,022 images and 1.43 million instances; the test set has 16,372 images and 468,000 instances. Training and test images were shot at different locations.

Keep panel (c) in mind. In the training set, 71% of the boxes hold only one instance, and the test set is higher still, at 80%. In other words, most boxes are just ordinary detection boxes, and the groups that actually need "counting" are a minority. This will matter later when we read the results.
How the Evaluation Works
To score location and count together, the authors extend COCO AP into . For a detection to count as correct, it has to meet two conditions:
- Its IoU with the annotated box reaches the threshold .
- Its counting accuracy AC reaches the threshold .
is the predicted count and the annotated count. Both and run from 0.50 to 0.95 in steps of 0.05, 10 thresholds each; the score is taken over every pair of thresholds and then averaged over all classes.
Let's plug in a few numbers to get a feel for how strict this is.
A box holds 10 plates and the model says 9, so AC is 0.9, which passes the 9 counting thresholds from 0.50 to 0.90 and fails only at 0.95.
A box holds 2 and the model says 1, so AC is 0.5, which passes only the loosest threshold.
A box holds 5 and the model says 1, so AC is 0.2, which fails every threshold.
That last case is exactly where an ordinary detector stands. Detectors can't count, so in evaluation the authors treat every one of their boxes as "1", which means they get every group wrong; on single instances, though, they lose nothing.
Solution

The authors' baseline is called CLCNet (cascaded localization and counting network), and its skeleton is Cascade R-CNN.
The idea of Cascade R-CNN is to chain the detection head into several stages, each taking the boxes refined by the previous stage as input. During training, the IoU threshold for positive samples rises from stage to stage, so the boxes get more accurate at every stage. CLCNet keeps this setup, with an IoU threshold of at stage , and adds a counting head next to the classification and regression heads of every stage.
With only one stage, CLCNet is Faster R-CNN plus a counting head.
Counting by Classification
The most intuitive counting head is a regressor, with one fully connected layer outputting a float, trained with smooth L1.
The authors point out that this gets stuck. Suppose there are two boxes, one holding 4 bowls and one holding 5, and the model predicts 4.5 for both. For the first box, the gradient pushes it down; for the second, it pushes it up. With two stacks of bowls that look almost identical, the model can't tell which way to lean.
So the authors turn counting into classification. With at most instances, there are classes, and the counting head only has to pick the right one.
But classifying 50 ways in one go is just as hard, since neighboring classes look almost the same. CLCNet uses its cascade to narrow the range step by step, from coarse to fine.
The authors' example is binary. With , 6 bits are enough, because . There are three stages, and each stage reads two more bits:
| Stage | Bits read | Bins | Bin width |
|---|---|---|---|
| 1 | First 2 | 4 | 16 |
| 2 | First 4 | 16 | 4 |
| 3 | All 6 | 64 | 1 |
The first stage only has to judge whether the stack is roughly 1 to 16, 17 to 32, and so on; the second narrows that to bins of 4; only the last stage settles the exact number. The row of images at the bottom of Figure 3 shows exactly this process: the bowls start at (1-16), then (1-4), and finally Bowl(3).
At each stage, the split into positive and negative samples follows these progressively finer counting ranges as well as IoU. The base doesn't have to be binary; octal or decimal works too, and the paper's experiments use both binary and decimal.
The overall loss is the sum of three terms: cross-entropy for classification, smooth L1 for box regression, and for the counting head either smooth L1 or cross-entropy, depending on whether it regresses or classifies.
Discussion
All methods are implemented in mmdetection; CLCNet uses ResNet-50 with FPN and is trained on a single Titan Xp. In the naming, s(N) means N stages, reg is regression counting, and cls(γ) is classification counting in base γ.
Main Results
| Method | COCO AP | |||
|---|---|---|---|---|
| SSD | 32.4 | 27.9 | 47.5 | 30.7 |
| FCOS | 40.6 | 37.2 | 52.2 | 43.5 |
| RetinaNet | 42.6 | 37.1 | 52.1 | 43.7 |
| Faster R-CNN | 45.3 | 39.7 | 56.7 | 46.8 |
| Cascade R-CNN | 46.8 | 40.9 | 55.7 | 47.8 |
| CLCNet-s(3)-reg | 46.2 | 42.1 | 59.5 | 49.3 |
| CLCNet-s(2)-cls(2) | 46.7 | 43.1 | 60.0 | 50.5 |
| CLCNet-s(2)-cls(10) | 46.9 | 43.5 | 60.6 | 51.0 |
Source: Table 2 of the paper, excerpt.
Start with COCO AP on the left; this column only looks at whether the boxes are accurate. When CLCNet counts by classification, its localization is almost the same as Cascade R-CNN's (46.9 vs 46.8); when it counts by regression, localization drops a little (s(3)-reg gets 46.2). The authors think a float counting target disturbs the whole network, and classification counting doesn't have this problem.
The on the right is the score for the new task. The best CLCNet gets 43.5 and Cascade R-CNN gets 40.9, a gap of 2.6.
That gap is smaller than you might expect. The reason is probably the statistics figure from earlier: 80% of the boxes in the test set hold a single instance, an ordinary detector loses nothing on those, and it is wiped out only on the remaining fifth, the groups. The overall score is propped up by the mass of single instances.
Breaking It Down
The authors split the test set into three parts by the number of instances per box, individual (1), medium (2 to 10) and large (more than 10), and score each separately:
| Method | Individual | Medium | Large |
|---|---|---|---|
| CLCNet-s(1)-reg | 41.1 | 17.1 | 18.7 |
| CLCNet-s(6)-reg | 39.9 | 11.9 | 14.3 |
| CLCNet-s(1)-cls(2) | 42.4 | 26.4 | 19.1 |
| CLCNet-s(2)-cls(2) | 43.4 | 26.9 | 21.6 |
| CLCNet-s(2)-cls(10) | 43.7 | 26.7 | 21.1 |
Source: Table 3 of the paper, , excerpt.
This table is far more interesting than the main results.
Scores on individual instances are all in the low forties, about the same as an ordinary detector. The real difficulty is the groups: once you get to "medium" and "large", the score is cut in half, down to around twenty. With count classification, piles of more than 10 are the hardest; the regression versions go either way, and their single-stage and six-stage variants score lower on "medium".
Switching counting from regression to classification helps most in the "medium" column, where the single-stage model jumps from 17.1 to 26.4.
More stages aren't always better either. Two stages are generally best; the six-stage regression version drops to 11.9 on "medium", worse than a single stage. The authors put this down to too many parameters and overfitting.
As for scale, small objects (box side under 150 pixels) score only in the low twenties on , while large objects score in the forties. That matches the usual experience in detection.
Can You Use It?
The paper's first page says the dataset is hosted on the GitLab of the Institute of Software at the Chinese Academy of Sciences. Click through in November 2026 and you get redirected to a GitLab login page (apparently there's more than one definition of a "public dataset"). We couldn't find an official public release of the CLCNet code either.
The arXiv preprint was withdrawn by the authors in December 2020, and the withdrawal comment is just two words: Information Error. If you want to read the paper, you'll have to find it in the AAAI proceedings.
Conclusion
The problem Locount tackles is a very real one. With stacked plates and nested bowls, demanding "one box per instance" from annotators and detectors alike asks for something neither can deliver. Switching to "one box per group, with a count attached" makes annotation feasible, and brings the task closer to what a store actually wants to know when taking inventory.
turns counting accuracy into a threshold that runs parallel to IoU; the design is clean, and the scoring is strict. CLCNet contributes less: it adds a coarse-to-fine classification counting head to Cascade R-CNN and wins the main metric by 2.6 points.
The most interesting signal is hidden in Table 3. Groups score only about half as much as individual instances, and with count classification, the taller the stack, the harder it gets. What makes inventory genuinely hard is exactly these stacked products. The dataset, though, now sits behind a login, so if you want to try it yourself, step one is signing up for an account.