deepgee 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- deepgee-0.1.0/LICENSE +21 -0
- deepgee-0.1.0/PKG-INFO +325 -0
- deepgee-0.1.0/README.md +270 -0
- deepgee-0.1.0/deepgee/__init__.py +36 -0
- deepgee-0.1.0/deepgee/auth.py +154 -0
- deepgee-0.1.0/deepgee/data.py +413 -0
- deepgee-0.1.0/deepgee/models.py +491 -0
- deepgee-0.1.0/deepgee/utils.py +401 -0
- deepgee-0.1.0/deepgee.egg-info/PKG-INFO +325 -0
- deepgee-0.1.0/deepgee.egg-info/SOURCES.txt +13 -0
- deepgee-0.1.0/deepgee.egg-info/dependency_links.txt +1 -0
- deepgee-0.1.0/deepgee.egg-info/requires.txt +22 -0
- deepgee-0.1.0/deepgee.egg-info/top_level.txt +1 -0
- deepgee-0.1.0/setup.cfg +4 -0
- deepgee-0.1.0/setup.py +60 -0
deepgee-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 DeepGEE Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
deepgee-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: deepgee
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Earth Observation with Google Earth Engine and Deep Learning
|
|
5
|
+
Author: Pulakesh Pradhan
|
|
6
|
+
Author-email: pulakesh.mid@gmail.com
|
|
7
|
+
Project-URL: Documentation, https://github.com/pulakeshpradhan/deepgee#readme
|
|
8
|
+
Project-URL: Source, https://github.com/pulakeshpradhan/deepgee
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/pulakeshpradhan/deepgee/issues
|
|
10
|
+
Keywords: earth-observation gee google-earth-engine deep-learning remote-sensing
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: earthengine-api>=0.1.300
|
|
25
|
+
Requires-Dist: geemap>=0.20.0
|
|
26
|
+
Requires-Dist: numpy>=1.20.0
|
|
27
|
+
Requires-Dist: pandas>=1.3.0
|
|
28
|
+
Requires-Dist: rasterio>=1.2.0
|
|
29
|
+
Requires-Dist: matplotlib>=3.4.0
|
|
30
|
+
Requires-Dist: seaborn>=0.11.0
|
|
31
|
+
Requires-Dist: scikit-learn>=1.0.0
|
|
32
|
+
Requires-Dist: joblib>=1.0.0
|
|
33
|
+
Provides-Extra: tensorflow
|
|
34
|
+
Requires-Dist: tensorflow>=2.10.0; extra == "tensorflow"
|
|
35
|
+
Provides-Extra: pytorch
|
|
36
|
+
Requires-Dist: torch>=1.12.0; extra == "pytorch"
|
|
37
|
+
Requires-Dist: torchvision>=0.13.0; extra == "pytorch"
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: black>=22.0.0; extra == "dev"
|
|
41
|
+
Requires-Dist: flake8>=4.0.0; extra == "dev"
|
|
42
|
+
Requires-Dist: sphinx>=4.5.0; extra == "dev"
|
|
43
|
+
Dynamic: author
|
|
44
|
+
Dynamic: author-email
|
|
45
|
+
Dynamic: classifier
|
|
46
|
+
Dynamic: description
|
|
47
|
+
Dynamic: description-content-type
|
|
48
|
+
Dynamic: keywords
|
|
49
|
+
Dynamic: license-file
|
|
50
|
+
Dynamic: project-url
|
|
51
|
+
Dynamic: provides-extra
|
|
52
|
+
Dynamic: requires-dist
|
|
53
|
+
Dynamic: requires-python
|
|
54
|
+
Dynamic: summary
|
|
55
|
+
|
|
56
|
+
# DeepGEE: Earth Observation with Google Earth Engine and Deep Learning
|
|
57
|
+
|
|
58
|
+
[](https://www.python.org/downloads/)
|
|
59
|
+
[](LICENSE)
|
|
60
|
+
|
|
61
|
+
A comprehensive Python package for integrating **Google Earth Engine (GEE)** with **Deep Learning** for advanced Earth observation analysis.
|
|
62
|
+
|
|
63
|
+
## π Features
|
|
64
|
+
|
|
65
|
+
- **π Easy GEE Authentication**: Simple authentication and initialization
|
|
66
|
+
- **π₯ Data Download**: Direct download using geemap
|
|
67
|
+
- **π Spectral Indices**: Calculate NDVI, EVI, NDWI, NDBI, NBR, and more
|
|
68
|
+
- **π§ Deep Learning Models**: Pre-built classifiers for land cover classification
|
|
69
|
+
- **πΊοΈ Change Detection**: Temporal analysis and change detection
|
|
70
|
+
- **π Visualization**: Built-in plotting and mapping functions
|
|
71
|
+
- **π― Multiple Use Cases**: Land cover, crop monitoring, disaster response
|
|
72
|
+
|
|
73
|
+
## π¦ Installation
|
|
74
|
+
|
|
75
|
+
### Basic Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
pip install deepgee
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### With TensorFlow (for deep learning)
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
pip install deepgee[tensorflow]
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Development Installation
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/your-repo/deepgee.git
|
|
91
|
+
cd deepgee
|
|
92
|
+
pip install -e .[dev]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## π Quick Start
|
|
96
|
+
|
|
97
|
+
### 1. Authenticate and Initialize GEE
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
import deepgee
|
|
101
|
+
|
|
102
|
+
# Authenticate (first time only)
|
|
103
|
+
deepgee.authenticate_gee()
|
|
104
|
+
|
|
105
|
+
# Initialize with your project
|
|
106
|
+
deepgee.initialize_gee(project='your-project-id')
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### 2. Download Satellite Data
|
|
110
|
+
|
|
111
|
+
```python
|
|
112
|
+
from deepgee import GEEDataDownloader
|
|
113
|
+
|
|
114
|
+
# Create downloader
|
|
115
|
+
downloader = GEEDataDownloader()
|
|
116
|
+
|
|
117
|
+
# Define region of interest
|
|
118
|
+
roi = [85.0, 20.0, 87.0, 22.0] # [lon_min, lat_min, lon_max, lat_max]
|
|
119
|
+
|
|
120
|
+
# Create composite
|
|
121
|
+
composite = downloader.create_composite(
|
|
122
|
+
roi=roi,
|
|
123
|
+
start_date='2023-01-01',
|
|
124
|
+
end_date='2023-12-31',
|
|
125
|
+
sensor='landsat8',
|
|
126
|
+
add_indices=True,
|
|
127
|
+
add_elevation=True
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
# Download to local file
|
|
131
|
+
downloader.download_image(
|
|
132
|
+
composite,
|
|
133
|
+
output_path='composite.tif',
|
|
134
|
+
roi=roi,
|
|
135
|
+
scale=30
|
|
136
|
+
)
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### 3. Train Deep Learning Model
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
from deepgee import LandCoverClassifier
|
|
143
|
+
import pandas as pd
|
|
144
|
+
|
|
145
|
+
# Load training data
|
|
146
|
+
samples = pd.read_csv('training_samples.csv')
|
|
147
|
+
X = samples[feature_columns].values
|
|
148
|
+
y = samples['class'].values
|
|
149
|
+
|
|
150
|
+
# Create classifier
|
|
151
|
+
classifier = LandCoverClassifier(n_classes=9, architecture='dense')
|
|
152
|
+
|
|
153
|
+
# Build model
|
|
154
|
+
classifier.build_model(input_shape=(14,))
|
|
155
|
+
|
|
156
|
+
# Prepare data
|
|
157
|
+
X_train, X_test, y_train, y_test = classifier.prepare_data(X, y)
|
|
158
|
+
|
|
159
|
+
# Train
|
|
160
|
+
history = classifier.train(X_train, y_train, epochs=50)
|
|
161
|
+
|
|
162
|
+
# Evaluate
|
|
163
|
+
results = classifier.evaluate(X_test, y_test, class_names=class_names)
|
|
164
|
+
print(f"Accuracy: {results['accuracy']:.4f}")
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### 4. Apply to Full Image
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
from deepgee import load_geotiff, save_geotiff
|
|
171
|
+
|
|
172
|
+
# Load image
|
|
173
|
+
image, meta = load_geotiff('composite.tif')
|
|
174
|
+
|
|
175
|
+
# Reshape for prediction
|
|
176
|
+
n_bands, height, width = image.shape
|
|
177
|
+
image_reshaped = image.reshape(n_bands, -1).T
|
|
178
|
+
|
|
179
|
+
# Predict
|
|
180
|
+
predictions = classifier.predict(image_reshaped)
|
|
181
|
+
classified = predictions.reshape(height, width)
|
|
182
|
+
|
|
183
|
+
# Save result
|
|
184
|
+
save_geotiff(classified, 'classified.tif', meta, nodata=255)
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## π Examples
|
|
188
|
+
|
|
189
|
+
See the `examples/` directory for complete workflows:
|
|
190
|
+
|
|
191
|
+
- **Land Cover Classification**: `examples/land_cover_classification.py`
|
|
192
|
+
- **Change Detection**: `examples/change_detection.py`
|
|
193
|
+
- **Crop Monitoring**: `examples/crop_monitoring.py`
|
|
194
|
+
- **Disaster Assessment**: `examples/disaster_assessment.py`
|
|
195
|
+
|
|
196
|
+
## π οΈ Main Components
|
|
197
|
+
|
|
198
|
+
### Authentication (`deepgee.auth`)
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
import deepgee
|
|
202
|
+
|
|
203
|
+
# Authenticate
|
|
204
|
+
deepgee.authenticate_gee()
|
|
205
|
+
|
|
206
|
+
# Initialize
|
|
207
|
+
deepgee.initialize_gee(project='your-project-id')
|
|
208
|
+
|
|
209
|
+
# Check status
|
|
210
|
+
status = deepgee.auth.check_gee_status()
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
### Data Download (`deepgee.data`)
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
from deepgee import GEEDataDownloader, SpectralIndices
|
|
217
|
+
|
|
218
|
+
downloader = GEEDataDownloader()
|
|
219
|
+
|
|
220
|
+
# Create composite
|
|
221
|
+
composite = downloader.create_composite(roi, '2023-01-01', '2023-12-31')
|
|
222
|
+
|
|
223
|
+
# Add spectral indices
|
|
224
|
+
composite = SpectralIndices.add_all_indices(composite, sensor='landsat8')
|
|
225
|
+
|
|
226
|
+
# Download
|
|
227
|
+
downloader.download_image(composite, 'output.tif', roi=roi)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Deep Learning Models (`deepgee.models`)
|
|
231
|
+
|
|
232
|
+
```python
|
|
233
|
+
from deepgee import LandCoverClassifier, ChangeDetector
|
|
234
|
+
|
|
235
|
+
# Land cover classification
|
|
236
|
+
classifier = LandCoverClassifier(n_classes=9)
|
|
237
|
+
classifier.build_model(input_shape=(14,))
|
|
238
|
+
classifier.train(X_train, y_train)
|
|
239
|
+
|
|
240
|
+
# Change detection
|
|
241
|
+
detector = ChangeDetector(method='difference')
|
|
242
|
+
changes = detector.detect_changes(image1, image2, threshold=0.2)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
### Utilities (`deepgee.utils`)
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from deepgee import (
|
|
249
|
+
load_geotiff, save_geotiff, calculate_area_stats,
|
|
250
|
+
plot_confusion_matrix, plot_classification_map
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
# Load/save data
|
|
254
|
+
image, meta = load_geotiff('input.tif')
|
|
255
|
+
save_geotiff(output, 'output.tif', meta)
|
|
256
|
+
|
|
257
|
+
# Calculate statistics
|
|
258
|
+
stats = calculate_area_stats(classified, class_names, pixel_size=30)
|
|
259
|
+
|
|
260
|
+
# Visualize
|
|
261
|
+
plot_classification_map(classified, class_names, class_colors)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## π Documentation
|
|
265
|
+
|
|
266
|
+
Full documentation available at: [https://deepgee.readthedocs.io/](https://deepgee.readthedocs.io/)
|
|
267
|
+
|
|
268
|
+
## π― Use Cases
|
|
269
|
+
|
|
270
|
+
### 1. Land Cover Classification
|
|
271
|
+
|
|
272
|
+
Classify satellite imagery into multiple land cover types using deep learning.
|
|
273
|
+
|
|
274
|
+
### 2. Crop Monitoring
|
|
275
|
+
|
|
276
|
+
Monitor crop health and predict yields using time series analysis.
|
|
277
|
+
|
|
278
|
+
### 3. Change Detection
|
|
279
|
+
|
|
280
|
+
Detect changes in land cover over time for deforestation, urbanization, etc.
|
|
281
|
+
|
|
282
|
+
### 4. Disaster Response
|
|
283
|
+
|
|
284
|
+
Rapid assessment of flood extent, fire damage, or other disasters.
|
|
285
|
+
|
|
286
|
+
### 5. Urban Planning
|
|
287
|
+
|
|
288
|
+
Extract building footprints and monitor urban growth.
|
|
289
|
+
|
|
290
|
+
## π€ Contributing
|
|
291
|
+
|
|
292
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
293
|
+
|
|
294
|
+
## π License
|
|
295
|
+
|
|
296
|
+
This project is licensed under the MIT License - see [LICENSE](LICENSE) file for details.
|
|
297
|
+
|
|
298
|
+
## π Acknowledgments
|
|
299
|
+
|
|
300
|
+
- Google Earth Engine team for the amazing platform
|
|
301
|
+
- geemap developers for the excellent Python package
|
|
302
|
+
- TensorFlow/Keras teams for deep learning frameworks
|
|
303
|
+
|
|
304
|
+
## π§ Contact
|
|
305
|
+
|
|
306
|
+
- **Issues**: [GitHub Issues](https://github.com/your-repo/deepgee/issues)
|
|
307
|
+
- **Email**: <pulakesh.mid@gmail.com>>
|
|
308
|
+
- **Documentation**: [ReadTheDocs](https://deepgee.readthedocs.io/)
|
|
309
|
+
|
|
310
|
+
## π Citation
|
|
311
|
+
|
|
312
|
+
If you use DeepGEE in your research, please cite:
|
|
313
|
+
|
|
314
|
+
```bibtex
|
|
315
|
+
@software{deepgee2024,
|
|
316
|
+
title={DeepGEE: Earth Observation with Google Earth Engine and Deep Learning},
|
|
317
|
+
author={Pulakesh Pradhan},
|
|
318
|
+
year={2024},
|
|
319
|
+
url={https://github.com/pulakeshpradhan/deepgee}
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
---
|
|
324
|
+
|
|
325
|
+
**Made with β€οΈ for the Earth Observation community**
|
deepgee-0.1.0/README.md
ADDED
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
# DeepGEE: Earth Observation with Google Earth Engine and Deep Learning
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/downloads/)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
A comprehensive Python package for integrating **Google Earth Engine (GEE)** with **Deep Learning** for advanced Earth observation analysis.
|
|
7
|
+
|
|
8
|
+
## π Features
|
|
9
|
+
|
|
10
|
+
- **π Easy GEE Authentication**: Simple authentication and initialization
|
|
11
|
+
- **π₯ Data Download**: Direct download using geemap
|
|
12
|
+
- **π Spectral Indices**: Calculate NDVI, EVI, NDWI, NDBI, NBR, and more
|
|
13
|
+
- **π§ Deep Learning Models**: Pre-built classifiers for land cover classification
|
|
14
|
+
- **πΊοΈ Change Detection**: Temporal analysis and change detection
|
|
15
|
+
- **π Visualization**: Built-in plotting and mapping functions
|
|
16
|
+
- **π― Multiple Use Cases**: Land cover, crop monitoring, disaster response
|
|
17
|
+
|
|
18
|
+
## π¦ Installation
|
|
19
|
+
|
|
20
|
+
### Basic Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install deepgee
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### With TensorFlow (for deep learning)
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install deepgee[tensorflow]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Development Installation
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
git clone https://github.com/your-repo/deepgee.git
|
|
36
|
+
cd deepgee
|
|
37
|
+
pip install -e .[dev]
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## π Quick Start
|
|
41
|
+
|
|
42
|
+
### 1. Authenticate and Initialize GEE
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
import deepgee
|
|
46
|
+
|
|
47
|
+
# Authenticate (first time only)
|
|
48
|
+
deepgee.authenticate_gee()
|
|
49
|
+
|
|
50
|
+
# Initialize with your project
|
|
51
|
+
deepgee.initialize_gee(project='your-project-id')
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### 2. Download Satellite Data
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from deepgee import GEEDataDownloader
|
|
58
|
+
|
|
59
|
+
# Create downloader
|
|
60
|
+
downloader = GEEDataDownloader()
|
|
61
|
+
|
|
62
|
+
# Define region of interest
|
|
63
|
+
roi = [85.0, 20.0, 87.0, 22.0] # [lon_min, lat_min, lon_max, lat_max]
|
|
64
|
+
|
|
65
|
+
# Create composite
|
|
66
|
+
composite = downloader.create_composite(
|
|
67
|
+
roi=roi,
|
|
68
|
+
start_date='2023-01-01',
|
|
69
|
+
end_date='2023-12-31',
|
|
70
|
+
sensor='landsat8',
|
|
71
|
+
add_indices=True,
|
|
72
|
+
add_elevation=True
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# Download to local file
|
|
76
|
+
downloader.download_image(
|
|
77
|
+
composite,
|
|
78
|
+
output_path='composite.tif',
|
|
79
|
+
roi=roi,
|
|
80
|
+
scale=30
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 3. Train Deep Learning Model
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
from deepgee import LandCoverClassifier
|
|
88
|
+
import pandas as pd
|
|
89
|
+
|
|
90
|
+
# Load training data
|
|
91
|
+
samples = pd.read_csv('training_samples.csv')
|
|
92
|
+
X = samples[feature_columns].values
|
|
93
|
+
y = samples['class'].values
|
|
94
|
+
|
|
95
|
+
# Create classifier
|
|
96
|
+
classifier = LandCoverClassifier(n_classes=9, architecture='dense')
|
|
97
|
+
|
|
98
|
+
# Build model
|
|
99
|
+
classifier.build_model(input_shape=(14,))
|
|
100
|
+
|
|
101
|
+
# Prepare data
|
|
102
|
+
X_train, X_test, y_train, y_test = classifier.prepare_data(X, y)
|
|
103
|
+
|
|
104
|
+
# Train
|
|
105
|
+
history = classifier.train(X_train, y_train, epochs=50)
|
|
106
|
+
|
|
107
|
+
# Evaluate
|
|
108
|
+
results = classifier.evaluate(X_test, y_test, class_names=class_names)
|
|
109
|
+
print(f"Accuracy: {results['accuracy']:.4f}")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 4. Apply to Full Image
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from deepgee import load_geotiff, save_geotiff
|
|
116
|
+
|
|
117
|
+
# Load image
|
|
118
|
+
image, meta = load_geotiff('composite.tif')
|
|
119
|
+
|
|
120
|
+
# Reshape for prediction
|
|
121
|
+
n_bands, height, width = image.shape
|
|
122
|
+
image_reshaped = image.reshape(n_bands, -1).T
|
|
123
|
+
|
|
124
|
+
# Predict
|
|
125
|
+
predictions = classifier.predict(image_reshaped)
|
|
126
|
+
classified = predictions.reshape(height, width)
|
|
127
|
+
|
|
128
|
+
# Save result
|
|
129
|
+
save_geotiff(classified, 'classified.tif', meta, nodata=255)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## π Examples
|
|
133
|
+
|
|
134
|
+
See the `examples/` directory for complete workflows:
|
|
135
|
+
|
|
136
|
+
- **Land Cover Classification**: `examples/land_cover_classification.py`
|
|
137
|
+
- **Change Detection**: `examples/change_detection.py`
|
|
138
|
+
- **Crop Monitoring**: `examples/crop_monitoring.py`
|
|
139
|
+
- **Disaster Assessment**: `examples/disaster_assessment.py`
|
|
140
|
+
|
|
141
|
+
## π οΈ Main Components
|
|
142
|
+
|
|
143
|
+
### Authentication (`deepgee.auth`)
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
import deepgee
|
|
147
|
+
|
|
148
|
+
# Authenticate
|
|
149
|
+
deepgee.authenticate_gee()
|
|
150
|
+
|
|
151
|
+
# Initialize
|
|
152
|
+
deepgee.initialize_gee(project='your-project-id')
|
|
153
|
+
|
|
154
|
+
# Check status
|
|
155
|
+
status = deepgee.auth.check_gee_status()
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Data Download (`deepgee.data`)
|
|
159
|
+
|
|
160
|
+
```python
|
|
161
|
+
from deepgee import GEEDataDownloader, SpectralIndices
|
|
162
|
+
|
|
163
|
+
downloader = GEEDataDownloader()
|
|
164
|
+
|
|
165
|
+
# Create composite
|
|
166
|
+
composite = downloader.create_composite(roi, '2023-01-01', '2023-12-31')
|
|
167
|
+
|
|
168
|
+
# Add spectral indices
|
|
169
|
+
composite = SpectralIndices.add_all_indices(composite, sensor='landsat8')
|
|
170
|
+
|
|
171
|
+
# Download
|
|
172
|
+
downloader.download_image(composite, 'output.tif', roi=roi)
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Deep Learning Models (`deepgee.models`)
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
from deepgee import LandCoverClassifier, ChangeDetector
|
|
179
|
+
|
|
180
|
+
# Land cover classification
|
|
181
|
+
classifier = LandCoverClassifier(n_classes=9)
|
|
182
|
+
classifier.build_model(input_shape=(14,))
|
|
183
|
+
classifier.train(X_train, y_train)
|
|
184
|
+
|
|
185
|
+
# Change detection
|
|
186
|
+
detector = ChangeDetector(method='difference')
|
|
187
|
+
changes = detector.detect_changes(image1, image2, threshold=0.2)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Utilities (`deepgee.utils`)
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
from deepgee import (
|
|
194
|
+
load_geotiff, save_geotiff, calculate_area_stats,
|
|
195
|
+
plot_confusion_matrix, plot_classification_map
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
# Load/save data
|
|
199
|
+
image, meta = load_geotiff('input.tif')
|
|
200
|
+
save_geotiff(output, 'output.tif', meta)
|
|
201
|
+
|
|
202
|
+
# Calculate statistics
|
|
203
|
+
stats = calculate_area_stats(classified, class_names, pixel_size=30)
|
|
204
|
+
|
|
205
|
+
# Visualize
|
|
206
|
+
plot_classification_map(classified, class_names, class_colors)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## π Documentation
|
|
210
|
+
|
|
211
|
+
Full documentation available at: [https://deepgee.readthedocs.io/](https://deepgee.readthedocs.io/)
|
|
212
|
+
|
|
213
|
+
## π― Use Cases
|
|
214
|
+
|
|
215
|
+
### 1. Land Cover Classification
|
|
216
|
+
|
|
217
|
+
Classify satellite imagery into multiple land cover types using deep learning.
|
|
218
|
+
|
|
219
|
+
### 2. Crop Monitoring
|
|
220
|
+
|
|
221
|
+
Monitor crop health and predict yields using time series analysis.
|
|
222
|
+
|
|
223
|
+
### 3. Change Detection
|
|
224
|
+
|
|
225
|
+
Detect changes in land cover over time for deforestation, urbanization, etc.
|
|
226
|
+
|
|
227
|
+
### 4. Disaster Response
|
|
228
|
+
|
|
229
|
+
Rapid assessment of flood extent, fire damage, or other disasters.
|
|
230
|
+
|
|
231
|
+
### 5. Urban Planning
|
|
232
|
+
|
|
233
|
+
Extract building footprints and monitor urban growth.
|
|
234
|
+
|
|
235
|
+
## π€ Contributing
|
|
236
|
+
|
|
237
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
238
|
+
|
|
239
|
+
## π License
|
|
240
|
+
|
|
241
|
+
This project is licensed under the MIT License - see [LICENSE](LICENSE) file for details.
|
|
242
|
+
|
|
243
|
+
## π Acknowledgments
|
|
244
|
+
|
|
245
|
+
- Google Earth Engine team for the amazing platform
|
|
246
|
+
- geemap developers for the excellent Python package
|
|
247
|
+
- TensorFlow/Keras teams for deep learning frameworks
|
|
248
|
+
|
|
249
|
+
## π§ Contact
|
|
250
|
+
|
|
251
|
+
- **Issues**: [GitHub Issues](https://github.com/your-repo/deepgee/issues)
|
|
252
|
+
- **Email**: <pulakesh.mid@gmail.com>>
|
|
253
|
+
- **Documentation**: [ReadTheDocs](https://deepgee.readthedocs.io/)
|
|
254
|
+
|
|
255
|
+
## π Citation
|
|
256
|
+
|
|
257
|
+
If you use DeepGEE in your research, please cite:
|
|
258
|
+
|
|
259
|
+
```bibtex
|
|
260
|
+
@software{deepgee2024,
|
|
261
|
+
title={DeepGEE: Earth Observation with Google Earth Engine and Deep Learning},
|
|
262
|
+
author={Pulakesh Pradhan},
|
|
263
|
+
year={2024},
|
|
264
|
+
url={https://github.com/pulakeshpradhan/deepgee}
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
**Made with β€οΈ for the Earth Observation community**
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
DeepGEE: Earth Observation with Google Earth Engine and Deep Learning
|
|
3
|
+
=====================================================================
|
|
4
|
+
|
|
5
|
+
A Python package for integrating Google Earth Engine with deep learning
|
|
6
|
+
for advanced Earth observation analysis.
|
|
7
|
+
|
|
8
|
+
Features:
|
|
9
|
+
- GEE authentication and initialization
|
|
10
|
+
- Data download using geemap
|
|
11
|
+
- Spectral indices calculation
|
|
12
|
+
- Deep learning model training
|
|
13
|
+
- Land cover classification
|
|
14
|
+
- Change detection
|
|
15
|
+
- And more...
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
__version__ = "0.1.0"
|
|
19
|
+
__author__ = "Pulakesh Pradhan"
|
|
20
|
+
|
|
21
|
+
from .auth import authenticate_gee, initialize_gee
|
|
22
|
+
from .data import GEEDataDownloader, SpectralIndices
|
|
23
|
+
from .models import LandCoverClassifier, ChangeDetector
|
|
24
|
+
from .utils import load_geotiff, save_geotiff, calculate_area_stats
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
'authenticate_gee',
|
|
28
|
+
'initialize_gee',
|
|
29
|
+
'GEEDataDownloader',
|
|
30
|
+
'SpectralIndices',
|
|
31
|
+
'LandCoverClassifier',
|
|
32
|
+
'ChangeDetector',
|
|
33
|
+
'load_geotiff',
|
|
34
|
+
'save_geotiff',
|
|
35
|
+
'calculate_area_stats',
|
|
36
|
+
]
|