touati-kamel's picture
Upload README.md with huggingface_hub
628552e verified
|
Raw
History Blame Contribute Delete
5.21 kB
---
dataset_info:
features:
- name: image
dtype: image
- name: detections
list:
- name: class
dtype: string
- name: bbox_xyxy
list: float64
- name: confidence
dtype: float64
- name: yolo_labels
dtype: string
- name: image_annotated
dtype: image
splits:
- name: train
num_bytes: 11360605942.32
num_examples: 69018
download_size: 11350785810
dataset_size: 11360605942.32
configs:
- config_name: default
data_files:
- split: train
path: data/train-*
---
# Forest Fire Detection Dataset — Auto-Annotated
Bounding-box annotated version of [touati-kamel/forest-fire-dataset](https://huggingface.co/datasets/touati-kamel/forest-fire-dataset),
built for training forest-fire / smoke / fog object detection models.
## Overview
This dataset contains video frames auto-labeled with bounding boxes for fire and
smoke-related visual phenomena, using a zero-shot open-vocabulary object detector
(Grounding DINO). It is derived from the original `touati-kamel/forest-fire-dataset` image
classification dataset, which did not include bounding box annotations.
## Classes
| Class | Description |
|----------------|------------------------------------------------|
| `Fire` | Visible flame |
| `Fire-smoke` | Smoke originating from fire |
| `Fog` | Fog / mist in the scene |
| `Factory-smoke`| Industrial/factory smoke (non-fire smoke source)|
## Why a single `train` split?
The source frames were extracted from videos and then shuffled randomly before
being split into train/validation/test. Because consecutive video frames are
often 99%+ visually similar, this shuffling caused near-duplicate frames from
the same video clip to end up scattered across different splits -- a data
leakage problem that would make validation/test metrics unreliable (a model
could "memorize" a near-identical frame seen during training).
To fix this, all annotated frames from the original train/validation/test
splits have been merged into a single `train` split here. **Validation and
test splits will be added later**, sourced from separate, distinct videos not
present in `train`, to ensure clean evaluation without leakage.
## Annotation methodology
- **Model**: `IDEA-Research/grounding-dino-tiny` (zero-shot, open-vocabulary
object detection), run via Hugging Face `transformers`.
- **Prompts used** (mapped to class names):
- `"flame"``Fire`
- `"smoke from fire"``Fire-smoke`
- `"fog"``Fog`
- `"industrial smoke"``Factory-smoke`
- **Thresholds**: box confidence >= 0.30, text matching threshold >= 0.25.
- **Important**: these are automatically generated (teacher-model) annotations,
**not human-verified**. Expect some false positives/negatives, especially on
visually ambiguous frames (heavy haze, distant smoke, low light). Manual
review or a secondary verification pass is recommended before using this
data for anything beyond bootstrapping a first model.
## Schema
| Column | Type | Description |
|------------|---------------|----------------------------------------------------------------------|
| `image` | `Image` | Original, unannotated frame |
| `detections` | `list[dict]` | One entry per detected box: `{"class": str, "bbox_xyxy": [x1,y1,x2,y2], "confidence": float}` |
| `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 |
| `image_annotated` | `Image` (optional, some chunks) | Visual copy of `image` with boxes/labels drawn, for quick QA |
Class-to-ID mapping for `yolo_labels` is stored in `classes.json` at the repo root:
`{"0": "Fire", "1": "Fire-smoke", "2": "Fog", "3": "Factory-smoke"}` (order-dependent list).
## Usage
```python
from datasets import load_dataset
ds = load_dataset("touati-kamel/forest-fire-annotations")
example = ds["train"][0]
print(example["detections"])
print(example["yolo_labels"])
```
### Converting to a YOLO training folder
```python
import os
os.makedirs("yolo_dataset/images/train", exist_ok=True)
os.makedirs("yolo_dataset/labels/train", exist_ok=True)
for i, example in enumerate(ds["train"]):
example["image"].save(f"yolo_dataset/images/train/{i:07d}.jpg")
with open(f"yolo_dataset/labels/train/{i:07d}.txt", "w") as f:
f.write(example["yolo_labels"])
```
## Roadmap
- Add genuinely separate `validation` and `test` splits from new, distinct
video sources (not derived from frames already in `train`).
- Optional human-in-the-loop verification pass on a sample of auto-labeled
boxes to estimate label quality/precision.
## Source data
Original unannotated frames: [touati-kamel/forest-fire-dataset](https://huggingface.co/datasets/touati-kamel/forest-fire-dataset)
## Maintainer
Kamel Touati ([HuggingFace: touati-kamel](https://huggingface.co/touati-kamel),
[GitHub: KamelTouati](https://github.com/KamelTouati))