touati-kamel commited on
Commit
628552e
·
verified ·
1 Parent(s): 651237b

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +104 -0
README.md CHANGED
@@ -27,3 +27,107 @@ configs:
27
  - split: train
28
  path: data/train-*
29
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  - split: train
28
  path: data/train-*
29
  ---
30
+
31
+ # Forest Fire Detection Dataset — Auto-Annotated
32
+
33
+ Bounding-box annotated version of [touati-kamel/forest-fire-dataset](https://huggingface.co/datasets/touati-kamel/forest-fire-dataset),
34
+ built for training forest-fire / smoke / fog object detection models.
35
+
36
+ ## Overview
37
+
38
+ This dataset contains video frames auto-labeled with bounding boxes for fire and
39
+ smoke-related visual phenomena, using a zero-shot open-vocabulary object detector
40
+ (Grounding DINO). It is derived from the original `touati-kamel/forest-fire-dataset` image
41
+ classification dataset, which did not include bounding box annotations.
42
+
43
+ ## Classes
44
+
45
+ | Class | Description |
46
+ |----------------|------------------------------------------------|
47
+ | `Fire` | Visible flame |
48
+ | `Fire-smoke` | Smoke originating from fire |
49
+ | `Fog` | Fog / mist in the scene |
50
+ | `Factory-smoke`| Industrial/factory smoke (non-fire smoke source)|
51
+
52
+ ## Why a single `train` split?
53
+
54
+ The source frames were extracted from videos and then shuffled randomly before
55
+ being split into train/validation/test. Because consecutive video frames are
56
+ often 99%+ visually similar, this shuffling caused near-duplicate frames from
57
+ the same video clip to end up scattered across different splits -- a data
58
+ leakage problem that would make validation/test metrics unreliable (a model
59
+ could "memorize" a near-identical frame seen during training).
60
+
61
+ To fix this, all annotated frames from the original train/validation/test
62
+ splits have been merged into a single `train` split here. **Validation and
63
+ test splits will be added later**, sourced from separate, distinct videos not
64
+ present in `train`, to ensure clean evaluation without leakage.
65
+
66
+ ## Annotation methodology
67
+
68
+ - **Model**: `IDEA-Research/grounding-dino-tiny` (zero-shot, open-vocabulary
69
+ object detection), run via Hugging Face `transformers`.
70
+ - **Prompts used** (mapped to class names):
71
+ - `"flame"` → `Fire`
72
+ - `"smoke from fire"` → `Fire-smoke`
73
+ - `"fog"` → `Fog`
74
+ - `"industrial smoke"` → `Factory-smoke`
75
+ - **Thresholds**: box confidence >= 0.30, text matching threshold >= 0.25.
76
+ - **Important**: these are automatically generated (teacher-model) annotations,
77
+ **not human-verified**. Expect some false positives/negatives, especially on
78
+ visually ambiguous frames (heavy haze, distant smoke, low light). Manual
79
+ review or a secondary verification pass is recommended before using this
80
+ data for anything beyond bootstrapping a first model.
81
+
82
+ ## Schema
83
+
84
+ | Column | Type | Description |
85
+ |------------|---------------|----------------------------------------------------------------------|
86
+ | `image` | `Image` | Original, unannotated frame |
87
+ | `detections` | `list[dict]` | One entry per detected box: `{"class": str, "bbox_xyxy": [x1,y1,x2,y2], "confidence": float}` |
88
+ | `yolo_labels` | `string` | Same boxes pre-converted to YOLO format (`class_id x_center y_center width height`, normalized 0-1), one line per box, ready to write directly to `.txt` label files |
89
+ | `image_annotated` | `Image` (optional, some chunks) | Visual copy of `image` with boxes/labels drawn, for quick QA |
90
+
91
+ Class-to-ID mapping for `yolo_labels` is stored in `classes.json` at the repo root:
92
+ `{"0": "Fire", "1": "Fire-smoke", "2": "Fog", "3": "Factory-smoke"}` (order-dependent list).
93
+
94
+ ## Usage
95
+
96
+ ```python
97
+ from datasets import load_dataset
98
+
99
+ ds = load_dataset("touati-kamel/forest-fire-annotations")
100
+ example = ds["train"][0]
101
+ print(example["detections"])
102
+ print(example["yolo_labels"])
103
+ ```
104
+
105
+ ### Converting to a YOLO training folder
106
+
107
+ ```python
108
+ import os
109
+
110
+ os.makedirs("yolo_dataset/images/train", exist_ok=True)
111
+ os.makedirs("yolo_dataset/labels/train", exist_ok=True)
112
+
113
+ for i, example in enumerate(ds["train"]):
114
+ example["image"].save(f"yolo_dataset/images/train/{i:07d}.jpg")
115
+ with open(f"yolo_dataset/labels/train/{i:07d}.txt", "w") as f:
116
+ f.write(example["yolo_labels"])
117
+ ```
118
+
119
+ ## Roadmap
120
+
121
+ - Add genuinely separate `validation` and `test` splits from new, distinct
122
+ video sources (not derived from frames already in `train`).
123
+ - Optional human-in-the-loop verification pass on a sample of auto-labeled
124
+ boxes to estimate label quality/precision.
125
+
126
+ ## Source data
127
+
128
+ Original unannotated frames: [touati-kamel/forest-fire-dataset](https://huggingface.co/datasets/touati-kamel/forest-fire-dataset)
129
+
130
+ ## Maintainer
131
+
132
+ Kamel Touati ([HuggingFace: touati-kamel](https://huggingface.co/touati-kamel),
133
+ [GitHub: KamelTouati](https://github.com/KamelTouati))