Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🔥 Forest Fire Detection Model
|
| 2 |
+
|
| 3 |
+
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).
|
| 4 |
+
|
| 5 |
+
## Model Details
|
| 6 |
+
|
| 7 |
+
- **Architecture:** Sequential CNN with Conv2D, MaxPooling2D, Dense, Dropout layers.
|
| 8 |
+
- **Input Size:** 150x150 RGB images
|
| 9 |
+
- **Output:** Binary classification (`fire` or `nofire`)
|
| 10 |
+
- **Framework:** TensorFlow / Keras
|
| 11 |
+
|
| 12 |
+
## Training Data
|
| 13 |
+
|
| 14 |
+
- **Dataset:** [The Wildfire Dataset](https://www.kaggle.com/datasets/elmadafri/the-wildfire-dataset)
|
| 15 |
+
- **Classes:** `fire`, `nofire`
|
| 16 |
+
- **Preprocessing:** Images resized to 150x150, normalized to [0, 1]
|
| 17 |
+
|
| 18 |
+
## Training Script
|
| 19 |
+
|
| 20 |
+
The model was trained using the following script (see attached notebook for full details):
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
model = Sequential([
|
| 24 |
+
Input(shape=(150, 150, 3)),
|
| 25 |
+
Conv2D(32, (3,3), activation='relu'),
|
| 26 |
+
MaxPooling2D(pool_size=(2,2)),
|
| 27 |
+
Conv2D(64, (3, 3), activation='relu'),
|
| 28 |
+
MaxPooling2D(pool_size=(2, 2)),
|
| 29 |
+
Conv2D(128, (3, 3), activation='relu'),
|
| 30 |
+
MaxPooling2D(pool_size=(2, 2)),
|
| 31 |
+
Flatten(),
|
| 32 |
+
Dense(512, activation='relu'),
|
| 33 |
+
Dropout(0.5),
|
| 34 |
+
Dense(1, activation='sigmoid')
|
| 35 |
+
])
|
| 36 |
+
model.compile(optimizer='adam', loss='binary_crossentropy', metrics=['accuracy'])
|
| 37 |
+
model.fit(...)
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
## Intended Use
|
| 41 |
+
- **Use Case:** Automated detection of forest fires in aerial or ground images.
|
| 42 |
+
- **Limitations:** Not suitable for video, may not generalize to all forest types or lighting conditions.
|
| 43 |
+
|
| 44 |
+
## How to Use
|
| 45 |
+
```python
|
| 46 |
+
import requests
|
| 47 |
+
|
| 48 |
+
API_URL = "https://api-inference.huggingface.co/models/YOUR_USERNAME/YOUR_MODEL_NAME"
|
| 49 |
+
headers = {"Authorization": "Bearer YOUR_HF_API_TOKEN"}
|
| 50 |
+
|
| 51 |
+
with open("your_image.jpg", "rb") as f:
|
| 52 |
+
data = f.read()
|
| 53 |
+
response = requests.post(API_URL, headers=headers, files={"file": data})
|
| 54 |
+
print(response.json())
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Evaluation
|
| 58 |
+
- **Test Accuracy:** 70%
|
| 59 |
+
- **Metrics:** Not suitable for video, may not generalize to all forest types or lighting conditions.
|
| 60 |
+
|
| 61 |
+
## Citation
|
| 62 |
+
If you use this model, please cite the dataset and this repository.
|