smokxy commited on
Commit
365e139
Β·
1 Parent(s): 0e5cf7b

documentation

Browse files
Files changed (4) hide show
  1. Readme.md +202 -27
  2. imgs/audio.png +3 -0
  3. imgs/deforestation.png +3 -0
  4. imgs/yolo.png +3 -0
Readme.md CHANGED
@@ -1,30 +1,205 @@
1
- # Forest Surveillance System
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
- ## Directory Sturcture
4
  ```
5
- Nature-Nexus/
6
- β”œβ”€β”€ app.py # Main Streamlit application
7
- β”œβ”€β”€ prediction_engine.py # Unified prediction engine
8
- β”œβ”€β”€ models/ # Model files
9
- β”‚ β”œβ”€β”€ deforestation_model.onnx
10
- β”‚ β”œβ”€β”€ fire_detection_model.onnx
11
- β”‚ └── audio_model.pth
12
  β”œβ”€β”€ utils/
13
- β”‚ β”œβ”€β”€ model.py # Common model architectures
14
- β”‚ β”œβ”€β”€ process_img.py # Image processing utilities
15
- β”‚ β”œβ”€β”€ process_video.py # Video processing utilities
16
- β”‚ β”œβ”€β”€ process_audio.py # Audio processing utilities
17
- β”‚ β”œβ”€β”€ onnx_converter.py # ONNX conversion utility
18
- β”‚ β”œβ”€β”€ deforested_segmentor/ # Deforestation-specific utilities
19
- β”‚ β”‚ β”œβ”€β”€ __init__.py
20
- β”‚ β”‚ β”œβ”€β”€ model.py # Deforestation model loader
21
- β”‚ β”‚ └── predict.py # Deforestation prediction functions
22
- β”‚ β”œβ”€β”€ fire_detection/ # Fire detection-specific utilities
23
- β”‚ β”‚ β”œβ”€β”€ __init__.py
24
- β”‚ β”‚ β”œβ”€β”€ model.py # Fire detection model loader
25
- β”‚ β”‚ └── predict.py # Fire detection prediction functions
26
- β”‚ └── audio_processing/ # Audio processing-specific utilities
27
- β”‚ β”œβ”€β”€ __init__.py
28
- β”‚ β”œβ”€β”€ model.py # Audio model loader
29
- β”‚ └── predict.py # Audio prediction functions
30
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Nature Nexus - Forest Surveillance System
2
+
3
+ ## Overview
4
+
5
+ Nature Nexus is an advanced forest surveillance system designed to protect natural ecosystems through AI-powered monitoring. It combines multiple detection technologies to identify illegal activities, monitor deforestation, and detect potential threats to forest areas.
6
+
7
+ The application leverages:
8
+ - **Satellite Imagery Analysis** - Detects deforestation using segmentation models
9
+ - **Audio Surveillance** - Identifies unusual sounds like chainsaws, vehicles, and human activity
10
+ - **Object Detection** - Recognizes trespassers, vehicles, fires, and other threats
11
+
12
+ ## Features
13
+
14
+ ### 1. Deforestation Detection
15
+ - Analyzes satellite or aerial imagery to identify deforested areas
16
+ - Uses Attention U-Net segmentation model optimized with ONNX runtime
17
+ - Provides detailed metrics on forest coverage and deforestation levels
18
+ - Visualizes results with color-coded overlays
19
+
20
+ ![Image Description](imgs\deforestation.png)
21
+
22
+ ### 2. Forest Audio Surveillance
23
+ - Detects unusual sounds that may indicate illegal activities
24
+ - Classifies various sounds including:
25
+ - **Human Sounds**: Footsteps, coughing, laughing, breathing, etc.
26
+ - **Tool Sounds**: Chainsaw, hand saw
27
+ - **Vehicle Sounds**: Car horn, engine, siren
28
+ - **Other Sounds**: Crackling fire, fireworks
29
+ - Supports both uploaded audio files and real-time recording
30
+
31
+ ![Image Description](imgs\audio.png)
32
+
33
+ ### 3. Object Detection
34
+ - Identifies potential threats using YOLOv11 model
35
+ - Detects objects including:
36
+ - Humans (trespassers)
37
+ - Vehicles (cars, bikes, buses/trucks)
38
+ - Fire and smoke
39
+ - Processes images, videos, and camera feeds
40
+ - Alerts on potential threats with confidence scores
41
+
42
+ ![Image Description](imgs\yolo.png)
43
+
44
+ ## Getting Started
45
+
46
+ ### Prerequisites
47
+
48
+ - Python 3.8+
49
+ - pip package manager
50
+ - Virtual environment (recommended)
51
+
52
+ ### Installation
53
+
54
+ 1. Clone the repository
55
+ ```bash
56
+ git clone https://github.com/yourusername/nature-nexus.git
57
+ cd nature-nexus
58
+ ```
59
+
60
+ 2. Create and activate a virtual environment (optional but recommended)
61
+ ```bash
62
+ python -m venv venv
63
+ source venv/bin/activate # On Windows, use: venv\Scripts\activate
64
+ ```
65
+
66
+ 3. Install required dependencies
67
+ ```bash
68
+ pip install -r requirements.txt
69
+ ```
70
+
71
+ 4. Download models
72
+ ```bash
73
+ # Create models directory if it doesn't exist
74
+ mkdir -p models
75
+
76
+ ```
77
+
78
+ ### Running the Application
79
+
80
+ Launch the Streamlit application:
81
+ ```bash
82
+ streamlit run app.py
83
+ ```
84
+
85
+ The application will open in your default web browser at http://localhost:8501
86
+
87
+ ## Model Architecture
88
+
89
+ ### Deforestation Detection Model
90
+ - **Architecture**: Attention U-Net
91
+ - **Input**: Satellite/aerial imagery (RGB)
92
+ - **Output**: Binary segmentation mask (forest vs. deforested)
93
+ - **Optimization**: ONNX runtime for faster inference
94
+ - **Dataset**: The model was trained using multiple datasets:
95
+ - **Amazon Rainforest Dataset for Semantic Segmentation** by Bragagnolo, Lucimara; da Silva, Roberto Valmir; Grzybowski, JosΓ© Mario Vicensi
96
+ - Contains 30 GeoTIFF training images (512x512 pixels) with PNG masks (forest in white, non-forest in black)
97
+ - 15 GeoTIFF validation images with masks
98
+ - 15 GeoTIFF test images
99
+ - **Amazon and Atlantic Forest Image Datasets for Semantic Segmentation** by the same creators
100
+ - Training dataset: 499 Amazon and 485 Atlantic Forest GeoTIFF images (512x512 pixels) with PNG masks
101
+ - Validation dataset: 100 GeoTIFF images per biome with masks
102
+ - Test dataset: 20 GeoTIFF images per biome
103
+ - **Forest Aerial Images for Segmentation** from Kaggle (https://www.kaggle.com/datasets/quadeer15sh/augmented-forest-segmentation)
104
+ - The 4-channel datasets were converted to 3-channel and merged
105
+
106
+ [Space for deforestation model architecture visualization]
107
+
108
+ ### Audio Classification Model
109
+ - **Architecture**: Convolutional Neural Network (CNN)
110
+ - **Input**: Audio spectrograms
111
+ - **Output**: 14 sound classes with confidence scores
112
+ - **Features**: Mel-spectrogram analysis
113
+ - **Dataset**: **ESC-50: Dataset for Environmental Sound Classification**
114
+ - Contains various environmental sounds categorized for machine learning applications
115
+ - Used to train the model to recognize forest-relevant sounds including human activity, tools, vehicles, and natural sounds
116
+
117
+ [Space for audio model architecture visualization]
118
+
119
+ ### Object Detection Model
120
+ - **Architecture**: YOLOv11
121
+ - **Input**: Images/video frames
122
+ - **Output**: Bounding boxes, class labels, confidence scores
123
+ - **Classes**: Humans, vehicles, fire, smoke, etc.
124
+ - **Dataset**: A merged collection of several datasets from Roboflow, optimized for detecting forest-relevant objects such as:
125
+ - Human presence (trespassers, loggers)
126
+ - Various vehicles (trucks, cars, motorcycles)
127
+ - Fire and smoke detection
128
+ - Logging equipment
129
+
130
+ [Space for YOLO model architecture visualization]
131
+
132
+ ## System Architecture
133
 
 
134
  ```
135
+ nature-nexus/
136
+ β”‚
137
+ β”œβ”€β”€ app.py # Main Streamlit application
138
+ β”œβ”€β”€ prediction_engine.py # Deforestation model interface
139
+ β”‚
 
 
140
  β”œβ”€β”€ utils/
141
+ β”‚ β”œβ”€β”€ audio_model.py # Audio classification model
142
+ β”‚ β”œβ”€β”€ audio_processing.py # Audio preprocessing utilities
143
+ β”‚ β”œβ”€β”€ helpers.py # Helper functions for visualization
144
+ β”‚ β”œβ”€β”€ model.py # U-Net model definition
145
+ β”‚ β”œβ”€β”€ onnx_converter.py # Converts PyTorch models to ONNX
146
+ β”‚ β”œβ”€β”€ onnx_inference.py # YOLO object detection inference
147
+ β”‚ └── preprocess.py # Image preprocessing utilities
148
+ β”‚
149
+ └── models/ # Model weights (not included in repo)
150
+ β”œβ”€β”€ deforestation_model.onnx
151
+ β”œβ”€β”€ best_model.pth # Audio model
152
+ └── best_model.onnx # YOLO model
153
+ ```
154
+
155
+ ## Usage Guide
156
+
157
+ ### Deforestation Detection
158
+ 1. Select "Deforestation Detection" from the sidebar
159
+ 2. Upload satellite or aerial imagery of forest areas
160
+ 3. View segmentation results showing forest vs. deforested areas
161
+ 4. Analyze metrics including forest coverage and deforestation level
162
+
163
+ ### Audio Surveillance
164
+ 1. Select "Forest Audio Surveillance" from the sidebar
165
+ 2. Choose between uploading audio files or recording live audio
166
+ 3. Submit the audio for analysis
167
+ 4. View detected sound classification and potential alerts
168
+
169
+ ### Object Detection
170
+ 1. Select "Object Detection" from the sidebar
171
+ 2. Choose between image, video, or camera feed
172
+ 3. Adjust confidence and IoU thresholds as needed
173
+ 4. Upload or capture input for processing
174
+ 5. View detection results with bounding boxes and confidence scores
175
+
176
+ ## Custom Model Training
177
+
178
+ To train custom models for your specific forest environment:
179
+
180
+ ### Deforestation Model
181
+ ```bash
182
+ # Convert trained PyTorch model to ONNX
183
+ python -m utils.onnx_converter models/your_pytorch_model.pth models/deforestation_model.onnx [input_size]
184
+ ```
185
+
186
+ ### Audio Model
187
+ Train on your custom audio dataset and replace the model file at `models/best_model.pth`
188
+
189
+ ### YOLO Model
190
+ Train on your custom object dataset and replace the model file at `models/best_model.onnx`
191
+
192
+ ## Troubleshooting
193
+
194
+ ### Common Issues
195
+ - **Models not loading**: Ensure all model files exist in the `models/` directory
196
+ - **CUDA errors**: If using GPU, verify CUDA and cuDNN are correctly installed
197
+ - **Audio processing issues**: Check audio format compatibility (WAV, MP3, OGG)
198
+
199
+ ## Contributing
200
+
201
+ Contributions are welcome! Please feel free to submit a Pull Request.
202
+
203
+ ## License
204
+
205
+ This project is licensed under the MIT License - see the LICENSE file for details.
imgs/audio.png ADDED

Git LFS Details

  • SHA256: 6ef54c1d815e558f9206eb240e02c59b96d0508c3367404dc5432039ecb20623
  • Pointer size: 131 Bytes
  • Size of remote file: 171 kB
imgs/deforestation.png ADDED

Git LFS Details

  • SHA256: 0908d34ca208e9bc3ad07d51b4ca5bcdf8b0ea151d144b674dfe54044e51d883
  • Pointer size: 131 Bytes
  • Size of remote file: 295 kB
imgs/yolo.png ADDED

Git LFS Details

  • SHA256: d1311ab5845cf86be3ad50589b4a8af63a4126ce3abbd6e6e9c127ecb2494b61
  • Pointer size: 131 Bytes
  • Size of remote file: 758 kB