File size: 3,583 Bytes
f3ee93a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
task_categories:
  - object-detection
tags:
  - yolo
  - obb
  - oriented-bounding-box
  - cubes
  - robotics
  - synthetic
size_categories:
  - n<1K
pretty_name: Colored Cubes OBB Detection
---

# Colored Cubes OBB Detection Dataset

A small object-detection dataset for **oriented bounding box (OBB)** detection of
four colored cubes (green, yellow, blue, red). Intended for training and
benchmarking YOLO-OBB style models in robotic-manipulation and pick-and-place
contexts.

## Dataset Summary

- **Task:** Oriented bounding box detection (4-point polygon per object)
- **Classes:** 4 — `green_cube`, `yellow_cube`, `blue_cube`, `red_cube`
- **Images:** 215 total · 1280×720 JPEG
- **Format:** Ultralytics YOLO-OBB
- **Splits:**

  | Split | Images | green | yellow | blue | red |
  |-------|-------:|------:|-------:|-----:|----:|
  | train |    150 |   150 |    153 |  147 | 150 |
  | val   |     43 |    43 |     44 |   42 |  43 |
  | test  |     22 |    22 |     22 |   22 |  22 |

  Every image contains all four cubes.

## Directory Layout

```
.
├── dataset.yaml          # Ultralytics data config
├── train/
│   ├── images/           # 00001.jpg …
│   └── labels/           # 00001.txt …
├── val/
│   ├── images/
│   └── labels/
└── test/
    ├── images/
    └── labels/
```

## Label Format

Each `labels/*.txt` has one object per line, in YOLO-OBB format:

```
class_id  x1 y1  x2 y2  x3 y3  x4 y4
```

- `class_id` — integer 0–3 (see `dataset.yaml`)
- `x*, y*` — polygon corner coordinates, **normalized** to `[0, 1]` by image
  width/height, traversed in order (TL → TR → BR → BL).

Example:

```
0 0.3460 0.5683  0.4078 0.5917  0.3890 0.7493  0.3271 0.7259
```

## Usage

### With Ultralytics YOLO

```bash
pip install ultralytics huggingface_hub
```

```python
from huggingface_hub import snapshot_download
from ultralytics import YOLO

local_dir = snapshot_download(
    repo_id="<your-username>/cubes-obb",
    repo_type="dataset",
)

model = YOLO("yolo11n-obb.pt")
model.train(data=f"{local_dir}/dataset.yaml", epochs=100, imgsz=1280)
```

### Loading labels manually

```python
from pathlib import Path

def load_obb(label_path):
    out = []
    for line in Path(label_path).read_text().splitlines():
        parts = line.split()
        cls = int(parts[0])
        coords = list(map(float, parts[1:]))  # 8 floats
        out.append((cls, coords))
    return out
```

## Class Mapping

| ID | Name         |
|----|--------------|
| 0  | green_cube   |
| 1  | yellow_cube  |
| 2  | blue_cube    |
| 3  | red_cube     |

## Author

Mohsin Ali — [Movensys](https://movensys.com)

## Collection & Annotation

Images were captured for a cube pick-and-place / OBB-detection research
workflow. Labels are in Ultralytics YOLO-OBB polygon format.

## Limitations

- **Small scale (215 images).** Fine for fine-tuning a pretrained OBB model,
  too small to train from scratch.
- **Every image contains all four cubes in similar scenes.** Models trained
  here may not generalize to scenes with missing cubes, unseen backgrounds,
  occlusion, or varying lighting.
- **Single resolution (1280×720).** Resize / letterbox if your pipeline
  expects another size.

## License

Released under the MIT License. See `LICENSE`.

## Citation

If you use this dataset, please cite:

```
@misc{cubes_obb_dataset,
  title        = {Colored Cubes OBB Detection Dataset},
  author       = {Mohsin Ali},
  year         = {2026},
  howpublished = {Hugging Face Datasets},
}
```