File size: 4,120 Bytes
2621b6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e4fc7db
 
 
 
6d0efa8
 
2621b6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6d0efa8
 
2621b6f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
pretty_name: Cubes Counting Database
language:
  - en
size_categories:
  - n<1K
tags:
  - computer-vision
  - object-counting
  - benchmark
  - robustness
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/*.parquet
---

# Cubes Counting Database

A small, controlled image dataset for testing how well computer-vision models **count objects**
as the number of objects, the amount of visual clutter and the capture conditions change.

Each photo shows red cubes (the primary thing to count) mixed with a controlled number of black
cubes (distractors that can also be counted). Every physical toss is photographed by two cameras
at once: one looking straight down and one from the side.

## Collection design

- **Red cubes** per level: 1, 2, 3, 5, 7, 10, 13, 16, 20, 25, 35, 50 (12 levels, `level_index` 1-12).
- **Noise ratio** 0, 0.5, 1, 2. The number of black cubes is `ceil(noise_ratio * n_red)`.
- Two combinations are not collected: (1 red, 0.5) and (50 red, 2). For 35 red at noise 2 the
  design would need 70 black cubes, so 50 black cubes are used instead (`noise_ratio` stays at its
  nominal 2, `n_black` is the truth). That leaves **46 red/black combinations** per capture
  condition.
- Each combination is tossed three times (`replicate` 1-3), once per `layout`: spread, clustered, stacked.
  Each toss is photographed by both cameras.
- Cubes are tossed onto the surface (`arrangement = tossed`).
- Cameras: two Logitech C920 webcams. Camera index 0 is the top-down (`nadir`) view,
  index 1 is the `side` view.
- Lighting (`diffuse` or `hard`) is fixed for a whole collection session.

## Structure

One row is one image. One physical toss (`scene_id`) gives two rows: `nadir` and `side`.
One red/black combination (`experiment_id`) groups all of its replicate tosses.

| Column | Type | Meaning |
|---|---|---|
| `image` | Image | The photo. |
| `n_red` | int32 | Red cubes physically present (1-50). Primary label. |
| `n_black` | int32 | Black cubes physically present. Second label: "count the black ones" is a valid task on the same image. |
| `camera_position` | string | `nadir` or `side`. |
| `lighting` | string | `diffuse` or `hard`. |
| `arrangement` | string | `tossed` or `placed`. This collection uses `tossed`. |
| `noise_ratio` | float32 | Nominal design value (0, 0.5, 1, 2). Metadata only: `n_black` is the ground truth. |
| `level_index` | int8 | Count stratum 1-12. Distinct from the count itself. |
| `scene_id` | string (ULID) | One physical toss. Shared by its nadir and side rows. |
| `experiment_id` | string (ULID) | One red/black combination. Shared by all of its replicate tosses. |
| `replicate` | int8 | Which toss of this combination (1, 2 or 3). |
| `layout` | string | How the cubes lie in the picture: `spread` (replicate 1), `clustered` (replicate 2) or `stacked` (replicate 3). |
| `camera_body` | string | Camera model (`C920`). |
| `captured_at` | timestamp[s, UTC] | Capture time. Detects time drift and recovers session order. |
| `human_annotator` | list of ClassLabel | Who counted, in order. Empty list means unlabeled. |
| `human_count_red` | list of int32 | Red count per annotator. Index i matches `human_annotator[i]`. |
| `human_count_black` | list of int32 | Black count per annotator, same alignment. |

The `human_*` columns are optional. Currently they are empty for every row.

## Usage

```python
from datasets import load_dataset

ds = load_dataset("szymmon/cubes-counting-database", split="train")
row = ds[0]
print(row["n_red"], row["n_black"], row["camera_position"])
row["image"]  # PIL image
```

Rows from the same toss share `scene_id`, so group or split on `scene_id` (or
`experiment_id`) to avoid putting the same toss on both sides of a train/test split.

## Limitations

- Small, single-setup dataset: one table, one pair of cameras, a limited set of lighting
  conditions.
- Ground-truth counts come from the experimental design (the cubes the collector prepared), not
  from annotation of the images (`n_red` and `n_black` are the cubes physically present).
- No license has been chosen yet.