Datasets:
File size: 9,734 Bytes
57fd61c 74c5b85 57fd61c 74c5b85 57fd61c 28f5b40 57fd61c 74c5b85 28f5b40 57fd61c 211b12e 57fd61c 211b12e 28f5b40 3c83ffb 211b12e 28f5b40 211b12e 28f5b40 211b12e 28f5b40 211b12e 28f5b40 211b12e 28f5b40 211b12e 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 211b12e 28f5b40 57fd61c 28f5b40 57fd61c 211b12e 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 28f5b40 57fd61c 211b12e 3c83ffb 211b12e 81697b5 211b12e 81697b5 74c5b85 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | ---
license: apache-2.0
pretty_name: KubriCount
task_categories:
- object-detection
tags:
- image
- synthetic
- object-counting
- visual-counting
- multi-grained-counting
- tar
- shards
---
# KubriCount
[Project Page](https://verg-avesta.github.io/KubriCount/) | [Paper](https://arxiv.org/abs/2605.10887) | [Code](https://github.com/Verg-Avesta/KubriCount)
KubriCount is a large-scale synthetic benchmark for **multi-grained visual counting**, built for the research project **Count Anything at Any Granularity**.
The dataset targets open-world counting settings where the intended counting granularity must be explicit. A query may ask for a specific identity, an attribute variant, a category, an instance type, or a broader concept. KubriCount provides controlled distractors and dense instance-level supervision for training and evaluation.
Companion generation pipeline code is available at [Verg-Avesta/KubriCount](https://github.com/Verg-Avesta/KubriCount).
The paper is available at [arXiv](https://arxiv.org/abs/2605.10887).
The released dataset can be used directly and does **not** require running the generation pipeline.
## Highlights
- **Five counting granularities**: identity, attribute, category, instance type, and concept.
- **Controlled generalization splits** for seen categories, unseen assets, and unseen categories.
- **Dense supervision** including counts, center points, 2D boxes, masks, negative categories, and scene metadata.
- **Large scale**: 110,507 released scenes/images, 198,702 annotation items/queries, 157 categories, about 7.3M annotated objects, and up to 250 objects per image.
- **Automatic data construction** with controllable 3D synthesis, mask-conditioned image editing, and VLM-based quality filtering.
## Dataset Statistics
| Split | Released scenes | Annotation items / queries | Purpose |
| --- | ---: | ---: | --- |
| `train` | 99,639 | 179,140 | Training split with seen categories. |
| `testA` | 5,462 | 9,837 | Evaluation split with unseen assets from training categories. |
| `testB` | 5,406 | 9,725 | Evaluation split with unseen categories. |
| **Total** | **110,507** | **198,702** | |
Levels 2-5 can yield two annotation items from one image by swapping the target and distractor groups. This is why the number of annotation items is larger than the number of released scenes.
## Level Statistics
| Level | Train normal | Train dense | TestA | TestB | Total scenes |
| --- | ---: | ---: | ---: | ---: | ---: |
| L1 | 16,179 | 3,959 | 1,087 | 1,087 | 22,312 |
| L2 size | 7,582 | 2,402 | 569 | 586 | 11,139 |
| L2 color | 8,043 | 2,135 | 600 | 602 | 11,380 |
| L3 | 15,386 | 3,624 | 1,053 | 1,014 | 21,077 |
| L4 | 16,493 | 4,186 | 1,081 | 1,081 | 22,841 |
| L5 | 15,825 | 3,825 | 1,072 | 1,036 | 21,758 |
| **Total** | **79,508** | **20,131** | **5,462** | **5,406** | **110,507** |
## Counting Levels
Each level defines a target set and, when applicable, a controlled distractor set that differs by one semantic factor.
| Level | Granularity | Description |
| --- | --- | --- |
| L1 | Identity-level | Count all visible target instances of a single object type. |
| L2 | Attribute-level | Count objects distinguished by size or color while excluding the other attribute variant. |
| L3 | Category-level | Count one category while excluding a different category. |
| L4 | Instance-level | Count one instance type while excluding another instance type from the same category. |
| L5 | Concept-level | Count a category or concept with multiple instance types and plausible distractors. |
## Generation Pipeline
KubriCount is generated in four stages:
1. **3D asset curation**: build a categorized 3D asset bank from labeled 3D datasets and controllable 3D generation.
2. **Prototype synthesis**: use Kubric, PyBullet, and Blender to render controllable multi-object scenes with exact instance metadata.
3. **Consistent image editing**: improve visual realism while preserving object topology and annotations.
4. **Automatic data filtering**: reject samples with layout drift, count changes, identity corruption, background hallucination, or severe artifacts.
The tar shards in this release contain only scenes that passed the automatic quality filter. The intermediate PASS/FAIL files are not included.
## Dataset Structure
```text
.
├── README.md
├── merged_train_metadata.json
├── merged_test_metadata.json
├── metadata/
│ ├── all_pass_scenes.jsonl
│ ├── train_pass_scenes.jsonl
│ ├── testA_pass_scenes.jsonl
│ ├── testB_pass_scenes.jsonl
│ └── shards.jsonl
├── shards/
│ ├── train/
│ │ ├── train-000000.tar
│ │ ├── train-000001.tar
│ │ └── ...
│ ├── testA/
│ │ ├── testA-000000.tar
│ │ └── testA-000001.tar
│ └── testB/
│ ├── testB-000000.tar
│ └── testB-000001.tar
├── train/
│ └── extracted_metadata.json
├── testA/
│ └── extracted_metadata.json
└── testB/
└── extracted_metadata.json
```
## Files Inside Each Scene
The image folders are stored inside tar shards. Each tar preserves the split/level/timestamp/scene structure:
```text
train/level5/20260205_135900/scene_0431/edited_00000.png
train/level5/20260205_135900/scene_0431/metadata.json
train/level5/20260205_135900/scene_0431/rgba_00000.png
train/level5/20260205_135900/scene_0431/segmentation_00000.png
```
Typical scene files:
- `edited_00000.png`: final edited image used by the benchmark.
- `rgba_00000.png`: original rendered RGBA image before editing.
- `segmentation_00000.png`: instance segmentation map.
- `metadata.json`: scene-level generation metadata, including camera, asset, split, level, and object information.
## Path Convention
All KubriCount image paths in the released annotation files are relative paths. For example:
```text
testA/level1/20260205_132725/scene_0213/edited_00000.png
```
After extracting the tar shards into a local directory, resolve an `image_id` with:
```python
from pathlib import Path
root = Path("./KubriCount_restored")
image_path = root / "testA/level1/20260205_132725/scene_0213/edited_00000.png"
```
## Annotation Files
- `train/extracted_metadata.json`, `testA/extracted_metadata.json`, `testB/extracted_metadata.json`: split-level KubriCount annotations.
- `merged_train_metadata.json`: merged KubriCount training metadata.
- `merged_test_metadata.json`: combined test metadata for `testA` and `testB`.
- `metadata/*_pass_scenes.jsonl`: scene-to-shard manifests.
- `metadata/shards.jsonl`: one record per tar shard.
A typical annotation item is:
```json
{
"image_id": "train/level1/20260205_132641/scene_0001/edited_00000.png",
"count": 104,
"box_examples_coordinates": [
[[742, 933], [742, 1024], [850, 1024], [850, 933]],
[[699, 782], [699, 888], [797, 888], [797, 782]]
],
"points": [
[796.0, 978.5],
[748.0, 835.0]
],
"H": 1024,
"W": 1024,
"category": "shoe",
"metadata": {
"level": 1,
"split": "train",
"config_file": "/kubric/config_gpt.json"
},
"negative_count": 0,
"negative_category": "",
"negative_box_examples_coordinates": [],
"negative_points": []
}
```
## Download
```python
from huggingface_hub import snapshot_download
snapshot_download(
repo_id="liuchang666/KubriCount",
repo_type="dataset",
local_dir="./KubriCount",
)
```
Command line:
```bash
huggingface-cli download liuchang666/KubriCount \
--repo-type dataset \
--local-dir ./KubriCount
```
## Restore the Folder Structure
Use the following script to extract the tar shards and copy the annotation JSON files to a restored directory:
```python
from pathlib import Path
import shutil
import tarfile
repo_dir = Path("./KubriCount")
restore_dir = Path("./KubriCount_restored")
splits = ["train", "testA", "testB"]
restore_dir.mkdir(parents=True, exist_ok=True)
def safe_extract(tar, path):
path = path.resolve()
for member in tar.getmembers():
target = (path / member.name).resolve()
if path not in target.parents and target != path:
raise RuntimeError(f"Unsafe path in tar: {member.name}")
tar.extractall(path)
for tar_path in sorted((repo_dir / "shards").glob("*/*.tar")):
print(f"Extracting {tar_path}")
with tarfile.open(tar_path, "r") as tar:
safe_extract(tar, restore_dir)
for p in repo_dir.glob("*.json"):
shutil.copy2(p, restore_dir / p.name)
for split in splits:
src_split_dir = repo_dir / split
dst_split_dir = restore_dir / split
dst_split_dir.mkdir(parents=True, exist_ok=True)
for p in src_split_dir.glob("*.json"):
shutil.copy2(p, dst_split_dir / p.name)
print(f"Restored dataset to: {restore_dir}")
```
## Read Images Directly From Tar Shards
```python
from pathlib import Path
import tarfile
repo_dir = Path("./KubriCount")
for tar_path in sorted((repo_dir / "shards").glob("*/*.tar")):
with tarfile.open(tar_path, "r") as tar:
for member in tar:
if member.isfile() and member.name.endswith(".png"):
data = tar.extractfile(member).read()
print(member.name, len(data))
break
```
## Citation
If you find this dataset useful, please cite:
```bibtex
@article{liu2026count,
title={Count Anything at Any Granularity},
author={Liu, Chang and Wu, Haoning and Xie, Weidi},
journal={arXiv preprint arXiv:2605.10887},
year={2026}
}
```
## Acknowledgements
KubriCount builds on the [Kubric](https://github.com/google-research/kubric) data generation framework.
## Contact
For questions, please contact liuchang666@sjtu.edu.cn. |