File size: 2,165 Bytes
6fad936
 
 
 
 
 
 
 
 
 
 
b1a2bad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
---
tags:
- image-classification
- forest-fire
- keras
- tensorflow
datasets:
- elmadafri/the-wildfire-dataset
---


# 🔥 Forest Fire Detection Model

This model detects forest fires in images using a deep learning CNN trained on the [Wildfire Dataset](https://www.kaggle.com/datasets/elmadafri/the-wildfire-dataset).

## Model Details

- **Architecture:** Sequential CNN with Conv2D, MaxPooling2D, Dense, Dropout layers.
- **Input Size:** 150x150 RGB images
- **Output:** Binary classification (`fire` or `nofire`)
- **Framework:** TensorFlow / Keras

## Training Data

- **Dataset:** [The Wildfire Dataset](https://www.kaggle.com/datasets/elmadafri/the-wildfire-dataset)
- **Classes:** `fire`, `nofire`
- **Preprocessing:** Images resized to 150x150, normalized to [0, 1]

## Training Script

The model was trained using the following script (see attached notebook for full details):

```python
model = Sequential([
    Input(shape=(150, 150, 3)),
    Conv2D(32, (3,3), activation='relu'),
    MaxPooling2D(pool_size=(2,2)),
    Conv2D(64, (3, 3), activation='relu'),
    MaxPooling2D(pool_size=(2, 2)),
    Conv2D(128, (3, 3), activation='relu'),
    MaxPooling2D(pool_size=(2, 2)),
    Flatten(),
    Dense(512, activation='relu'),
    Dropout(0.5),
    Dense(1, activation='sigmoid')
])
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
model.fit(...)
```

## Intended Use
- **Use Case:** Automated detection of forest fires in aerial or ground images.
- **Limitations:** Not suitable for video, may not generalize to all forest types or lighting conditions.

## How to Use
```python
import requests

API_URL = "https://api-inference.huggingface.co/models/YOUR_USERNAME/YOUR_MODEL_NAME"
headers = {"Authorization": "Bearer YOUR_HF_API_TOKEN"}

with open("your_image.jpg", "rb") as f:
    data = f.read()
response = requests.post(API_URL, headers=headers, files={"file": data})
print(response.json())
```

## Evaluation
- **Test Accuracy:** 70%
- **Metrics:** Not suitable for video, may not generalize to all forest types or lighting conditions.

## Citation
If you use this model, please cite the dataset and this repository.