Neylton commited on
Commit
59228b6
Β·
verified Β·
1 Parent(s): 898f820

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +167 -20
README.md CHANGED
@@ -1,20 +1,167 @@
1
- ---
2
- title: ZeroFire
3
- emoji: πŸš€
4
- colorFrom: red
5
- colorTo: red
6
- sdk: docker
7
- app_port: 8501
8
- tags:
9
- - streamlit
10
- pinned: false
11
- short_description: AI-Powered Fire Detection System for Data Centers
12
- license: mit
13
- ---
14
-
15
- # Welcome to Streamlit!
16
-
17
- Edit `/src/streamlit_app.py` to customize this app to your heart's desire. :heart:
18
-
19
- If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [community
20
- forums](https://discuss.streamlit.io).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: ZeroFire - AI Fire Detection System
3
+ emoji: πŸ”₯
4
+ colorFrom: red
5
+ colorTo: yellow
6
+ sdk: streamlit
7
+ sdk_version: 1.28.1
8
+ app_file: app.py
9
+ pinned: false
10
+ license: mit
11
+ python_version: 3.9
12
+ ---
13
+
14
+ # πŸ”₯ zeroFire - AI-Powered Fire Detection System
15
+
16
+ Advanced fire detection system for data centers using ConvNeXt deep learning architecture with transfer learning.
17
+
18
+ ## πŸš€ Features
19
+
20
+ - **Real-time Fire Detection**: Instant fire and smoke detection in data center environments
21
+ - **Advanced AI Model**: ConvNeXt Large architecture with transfer learning
22
+ - **Safety-Focused**: Weighted loss function prioritizing fire detection (minimizing false negatives)
23
+ - **Interactive Web Interface**: Beautiful Streamlit GUI for easy operation
24
+ - **Comprehensive Analysis**: Detailed risk assessment and safety recommendations
25
+ - **Emergency Response**: Built-in emergency protocols and contact information
26
+
27
+ ## πŸ“Š Model Performance
28
+
29
+ - **Architecture**: ConvNeXt Large + Custom Classification Head
30
+ - **Training**: Safety-focused with class weighting (Fire: 2.0, No-Fire: 1.0)
31
+ - **Data**: 80/20 train/validation split with data augmentation
32
+ - **Optimization**: AdamW optimizer with cosine annealing scheduler
33
+
34
+ ## πŸ› οΈ Installation
35
+
36
+ 1. **Clone the repository**:
37
+ ```bash
38
+ git clone <repository-url>
39
+ cd zeroFire
40
+ ```
41
+
42
+ 2. **Install dependencies**:
43
+ ```bash
44
+ pip install -r requirements.txt
45
+ ```
46
+
47
+ 3. **Prepare your data**: Ensure your data is organized in the following structure:
48
+ ```
49
+ data/
50
+ β”œβ”€β”€ train/
51
+ β”‚ β”œβ”€β”€ fire/ # Fire images
52
+ β”‚ └── no_fire/ # No-fire images
53
+ └── val/
54
+ β”œβ”€β”€ fire/ # Validation fire images
55
+ └── no_fire/ # Validation no-fire images
56
+ ```
57
+
58
+ ## πŸ”₯ Usage
59
+
60
+ ### Training the Model
61
+
62
+ Train the fire detection model:
63
+ ```bash
64
+ python train_fire_detection.py --epochs 50 --batch_size 16 --freeze_backbone
65
+ ```
66
+
67
+ ### Running the Web Interface
68
+
69
+ Start the Streamlit application:
70
+ ```bash
71
+ streamlit run app.py
72
+ ```
73
+
74
+ ### Command Line Training Options
75
+
76
+ ```bash
77
+ python train_fire_detection.py --help
78
+ ```
79
+
80
+ Options:
81
+ - `--data_dir`: Path to data directory (default: 'data')
82
+ - `--batch_size`: Batch size for training (default: 16)
83
+ - `--epochs`: Number of training epochs (default: 50)
84
+ - `--learning_rate`: Learning rate (default: 1e-4)
85
+ - `--freeze_backbone`: Freeze backbone for transfer learning
86
+
87
+ ## πŸ“ Project Structure
88
+
89
+ ```
90
+ zeroFire/
91
+ β”œβ”€β”€ app.py # Streamlit web interface
92
+ β”œβ”€β”€ train_fire_detection.py # Training script
93
+ β”œβ”€β”€ requirements.txt # Dependencies
94
+ β”œβ”€β”€ README.md # This file
95
+ β”œβ”€β”€ utils/
96
+ β”‚ β”œβ”€β”€ model_utils.py # Model utilities
97
+ β”‚ └── data_utils.py # Data handling utilities
98
+ β”œβ”€β”€ data/ # Dataset directory
99
+ β”‚ β”œβ”€β”€ train/
100
+ β”‚ β”‚ β”œβ”€β”€ fire/
101
+ β”‚ β”‚ └── no_fire/
102
+ β”‚ └── val/
103
+ β”‚ β”œβ”€β”€ fire/
104
+ β”‚ └── no_fire/
105
+ └── models/ # Trained models directory
106
+ └── fire_detection_classifier.pth
107
+ ```
108
+
109
+ ## 🎯 Safety Features
110
+
111
+ - **Class Weighting**: Fire class weighted 2x to minimize false negatives
112
+ - **Risk Assessment**: Multi-level risk analysis (Safe, Caution, Moderate, High, Critical)
113
+ - **Emergency Protocols**: Built-in emergency response recommendations
114
+ - **Real-time Monitoring**: Continuous confidence scoring and safety metrics
115
+
116
+ ## πŸ“Š Data Requirements
117
+
118
+ - **Minimum**: 500+ images per class
119
+ - **Recommended**: 1000+ images per class
120
+ - **Formats**: JPG, PNG, BMP, TIFF
121
+ - **Size**: Images automatically resized to 224x224
122
+ - **Quality**: Clear, well-lit images with proper labeling
123
+
124
+ ## πŸ”§ Technical Details
125
+
126
+ - **Framework**: PyTorch with timm library
127
+ - **Architecture**: ConvNeXt Large (Facebook AI)
128
+ - **Input Size**: 224x224 RGB images
129
+ - **Preprocessing**: ImageNet normalization with data augmentation
130
+ - **Training**: Mixed precision training with gradient clipping
131
+
132
+ ## 🚨 Emergency Response
133
+
134
+ The system provides automatic emergency response recommendations:
135
+
136
+ - **Critical (90%+)**: Immediate evacuation and fire suppression
137
+ - **High (75-90%)**: Rapid investigation and system preparation
138
+ - **Moderate (50-75%)**: Enhanced monitoring and verification
139
+ - **Caution (<50%)**: Increased vigilance and sensor checks
140
+
141
+ ## πŸ“ž Support
142
+
143
+ For technical support or questions:
144
+ - Check the web interface for real-time system status
145
+ - Review training logs for model performance
146
+ - Monitor confidence scores for prediction reliability
147
+
148
+ ## πŸ† Performance Metrics
149
+
150
+ The system tracks:
151
+ - **Accuracy**: Overall classification accuracy
152
+ - **Precision**: Fire detection precision (minimize false positives)
153
+ - **Recall**: Fire detection recall (minimize false negatives)
154
+ - **F1-Score**: Balanced performance metric
155
+ - **Confusion Matrix**: Detailed classification results
156
+
157
+ ## πŸ”’ Safety Considerations
158
+
159
+ - This system is designed as a supplementary fire detection tool
160
+ - Always maintain primary fire detection systems
161
+ - Regularly validate model performance with new data
162
+ - Update emergency contact information in the application
163
+ - Test system response procedures regularly
164
+
165
+ ---
166
+
167
+ **⚠️ Important**: This AI system is designed to assist with fire detection but should not replace professional fire safety equipment and procedures. Always follow local fire safety regulations and maintain proper fire suppression systems.