ApyHTML19 commited on
Commit
c251beb
·
verified ·
1 Parent(s): e67de74

Add dataset card

Browse files
Files changed (1) hide show
  1. README.md +76 -0
README.md CHANGED
@@ -1,3 +1,79 @@
1
  ---
2
  license: mit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: mit
3
+ task_categories:
4
+ - image-segmentation
5
+ - object-detection
6
+ language:
7
+ - ar
8
+ - fr
9
+ tags:
10
+ - coco
11
+ - instance-segmentation
12
+ - medicine
13
+ - medication-boxes
14
+ - mask-rcnn
15
+ pretty_name: Medication Boxes (Arabic / Latin)
16
+ size_categories:
17
+ - n<1K
18
  ---
19
+
20
+ # Medication Boxes — Arabic / Latin
21
+
22
+ This dataset contains photos of medication boxes, with packaging text in Arabic and Latin script (French and others). It is annotated for **COCO instance segmentation** and was built for **MediSeG**, which segments each box so the text on it can be read afterwards.
23
+
24
+ - **One class:** `1 = medicine_box` (`0 = background`)
25
+ - **Format:** COCO JSON (polygons + bbox)
26
+ - **Images:** original resolution, never resized
27
+
28
+ ## Structure
29
+
30
+ ```
31
+ train/ 540 images
32
+ val/ 68 images
33
+ test/ 68 images
34
+ annotations/
35
+ instances_train.json
36
+ instances_val.json
37
+ instances_test.json
38
+ ```
39
+
40
+ | Split | Images | Instances |
41
+ |---|---:|---:|
42
+ | train | 540 | 806 |
43
+ | val | 68 | 121 |
44
+ | test | 68 | 100 |
45
+ | **Total** | **676** | **1027** |
46
+
47
+ Each `images` entry also has three extra fields: `source`, `original_split` and `original_file`.
48
+
49
+ ## Sources
50
+
51
+ | Source | Images | Instances | Original annotation |
52
+ |---|---:|---:|---|
53
+ | `main_ar_fr` | 557 | 874 | YOLO-seg, 4-point polygons |
54
+ | `medicine_packv2` | 119 | 153 | COCO polygons (24 drug classes merged into `medicine_box`) |
55
+
56
+ The `drugs` source (1,068 images) was **left out** because it has bounding boxes only and no segmentation.
57
+
58
+ ## Preparation
59
+
60
+ - 80/10/10 split (seed 42), **grouped by source photo**. Near-duplicates (dHash of the object crop) go into the same split, which fixes the train/val/test leakage in the original splits (128 images affected).
61
+ - Checks: no corrupted images, no invalid annotations, no empty masks, no exact duplicates (md5).
62
+ - Validation: every split loads with `torchvision` `CocoDetection` + `wrap_dataset_for_transforms_v2`, and a `maskrcnn_resnet50_fpn(num_classes=2)` forward pass gives finite losses.
63
+
64
+ ## Usage
65
+
66
+ ```python
67
+ from huggingface_hub import snapshot_download
68
+ from torchvision.datasets import CocoDetection, wrap_dataset_for_transforms_v2
69
+
70
+ root = snapshot_download("ApyHTML19/Medication_Boxes_AR_Latin", repo_type="dataset")
71
+ ds = CocoDetection(f"{root}/train", f"{root}/annotations/instances_train.json")
72
+ ds = wrap_dataset_for_transforms_v2(ds, target_keys=("boxes", "labels", "masks"))
73
+ img, target = ds[0]
74
+ ```
75
+
76
+ ## Limitations
77
+
78
+ - Small dataset (676 images), a single class, no per-drug labels.
79
+ - The `main_ar_fr` polygons have 4 points, so masks are quadrilaterals that approximate the box outline.