Datasets:
Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -165,12 +165,19 @@ test_split = ds["test"] # 212 images — evaluation query set
|
|
| 165 |
# bbox : list of [x_min, y_min, width, height] (COCO format, float32)
|
| 166 |
# category : list of int (ClassLabel index; decode with int2str)
|
| 167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
# Decode category indices to class name strings
|
| 169 |
-
label_feature = ds["
|
| 170 |
-
label_feature.int2str(3) # → "Red Blood Cells"
|
| 171 |
|
| 172 |
-
|
| 173 |
-
|
|
|
|
|
|
|
|
|
|
| 174 |
```
|
| 175 |
|
| 176 |
> **Note on bbox format:** The Parquet files store bboxes in COCO format `[x_min, y_min, width, height]` as float32. `category` is stored as a `ClassLabel` integer index — use `int2str()` to get the string name. The raw `annotation.jsonl` files use `[[x_min, y_min], [x_max, y_max]]` (top-left / bottom-right pixel coordinates) — see [Annotation Format](#annotation-format).
|
|
|
|
| 165 |
# bbox : list of [x_min, y_min, width, height] (COCO format, float32)
|
| 166 |
# category : list of int (ClassLabel index; decode with int2str)
|
| 167 |
|
| 168 |
+
row = test_split[0]
|
| 169 |
+
|
| 170 |
+
# Image (PIL.Image)
|
| 171 |
+
image = row["image"]
|
| 172 |
+
|
| 173 |
# Decode category indices to class name strings
|
| 174 |
+
label_feature = ds["test"].features["objects"].feature["category"]
|
|
|
|
| 175 |
|
| 176 |
+
# Iterate over bounding boxes with labels
|
| 177 |
+
for bbox, category_idx in zip(row["objects"]["bbox"], row["objects"]["category"]):
|
| 178 |
+
x_min, y_min, width, height = bbox # COCO format (float32)
|
| 179 |
+
label = label_feature.int2str(category_idx)
|
| 180 |
+
print(f"{label}: [{x_min:.1f}, {y_min:.1f}, {width:.1f}, {height:.1f}]")
|
| 181 |
```
|
| 182 |
|
| 183 |
> **Note on bbox format:** The Parquet files store bboxes in COCO format `[x_min, y_min, width, height]` as float32. `category` is stored as a `ClassLabel` integer index — use `int2str()` to get the string name. The raw `annotation.jsonl` files use `[[x_min, y_min], [x_max, y_max]]` (top-left / bottom-right pixel coordinates) — see [Annotation Format](#annotation-format).
|