stumbledparams commited on
Commit
8e79ea8
·
verified ·
1 Parent(s): 43809ee

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +15 -8
README.md CHANGED
@@ -170,17 +170,24 @@ row = test_split[0]
170
  # Image (PIL.Image)
171
  image = row["image"]
172
 
173
- # Decode category indices to class name strings
174
- label_feature = ds["test"].features["objects"]["category"].feature
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).
184
 
185
  ## Dataset Statistics
186
 
 
170
  # Image (PIL.Image)
171
  image = row["image"]
172
 
173
+ # Bounding boxes and category indices
174
+ bboxes = row["objects"]["bbox"] # list of [x_min, y_min, width, height] (float32)
175
+ categories = row["objects"]["category"] # list of int (ClassLabel index)
176
+
177
+ # Class names in ClassLabel index order (alphabetically sorted)
178
+ CLASS_NAMES = [
179
+ "Gametocyte Cells", "Platelets", "Polygonal Cells", "Red Blood Cells",
180
+ "Ring Cells", "Round Cells", "Schizont Cells", "Spindle Cells",
181
+ "Trophozoite Cells", "White Blood Cells",
182
+ ]
183
+
184
+ for bbox, cat_idx in zip(bboxes, categories):
185
+ x_min, y_min, width, height = bbox
186
+ label = CLASS_NAMES[cat_idx]
187
  print(f"{label}: [{x_min:.1f}, {y_min:.1f}, {width:.1f}, {height:.1f}]")
188
  ```
189
 
190
+ > **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. 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).
191
 
192
  ## Dataset Statistics
193