Skip to main content

Earth Observation with Google Earth Engine and Deep Learning

Project description

DeepGEE: Earth Observation with Google Earth Engine and Deep Learning

Python Version License

A comprehensive Python package for integrating Google Earth Engine (GEE) with Deep Learning for advanced Earth observation analysis.

🌟 Features

  • 🔐 Easy GEE Authentication: Simple authentication and initialization
  • 📥 Data Download: Direct download using geemap
  • 📊 Spectral Indices: Calculate NDVI, EVI, NDWI, NDBI, NBR, and more
  • 🧠 Deep Learning Models: Pre-built classifiers for land cover classification
  • 🗺️ Change Detection: Temporal analysis and change detection
  • 📈 Visualization: Built-in plotting and mapping functions
  • 🎯 Multiple Use Cases: Land cover, crop monitoring, disaster response

📦 Installation

Basic Installation

pip install deepgee

With TensorFlow (for deep learning)

pip install deepgee[tensorflow]

Development Installation

git clone https://github.com/your-repo/deepgee.git
cd deepgee
pip install -e .[dev]

🚀 Quick Start

1. Authenticate and Initialize GEE

import deepgee

# Authenticate (first time only)
deepgee.authenticate_gee()

# Initialize with your project
deepgee.initialize_gee(project='your-project-id')

2. Download Satellite Data

from deepgee import GEEDataDownloader

# Create downloader
downloader = GEEDataDownloader()

# Define region of interest
roi = [85.0, 20.0, 87.0, 22.0]  # [lon_min, lat_min, lon_max, lat_max]

# Create composite
composite = downloader.create_composite(
    roi=roi,
    start_date='2023-01-01',
    end_date='2023-12-31',
    sensor='landsat8',
    add_indices=True,
    add_elevation=True
)

# Download to local file
downloader.download_image(
    composite,
    output_path='composite.tif',
    roi=roi,
    scale=30
)

3. Train Deep Learning Model

from deepgee import LandCoverClassifier
import pandas as pd

# Load training data
samples = pd.read_csv('training_samples.csv')
X = samples[feature_columns].values
y = samples['class'].values

# Create classifier
classifier = LandCoverClassifier(n_classes=9, architecture='dense')

# Build model
classifier.build_model(input_shape=(14,))

# Prepare data
X_train, X_test, y_train, y_test = classifier.prepare_data(X, y)

# Train
history = classifier.train(X_train, y_train, epochs=50)

# Evaluate
results = classifier.evaluate(X_test, y_test, class_names=class_names)
print(f"Accuracy: {results['accuracy']:.4f}")

4. Apply to Full Image

from deepgee import load_geotiff, save_geotiff

# Load image
image, meta = load_geotiff('composite.tif')

# Reshape for prediction
n_bands, height, width = image.shape
image_reshaped = image.reshape(n_bands, -1).T

# Predict
predictions = classifier.predict(image_reshaped)
classified = predictions.reshape(height, width)

# Save result
save_geotiff(classified, 'classified.tif', meta, nodata=255)

📚 Examples

See the examples/ directory for complete workflows:

  • Land Cover Classification: examples/land_cover_classification.py
  • Change Detection: examples/change_detection.py
  • Crop Monitoring: examples/crop_monitoring.py
  • Disaster Assessment: examples/disaster_assessment.py

🛠️ Main Components

Authentication (deepgee.auth)

import deepgee

# Authenticate
deepgee.authenticate_gee()

# Initialize
deepgee.initialize_gee(project='your-project-id')

# Check status
status = deepgee.auth.check_gee_status()

Data Download (deepgee.data)

from deepgee import GEEDataDownloader, SpectralIndices

downloader = GEEDataDownloader()

# Create composite
composite = downloader.create_composite(roi, '2023-01-01', '2023-12-31')

# Add spectral indices
composite = SpectralIndices.add_all_indices(composite, sensor='landsat8')

# Download
downloader.download_image(composite, 'output.tif', roi=roi)

Deep Learning Models (deepgee.models)

from deepgee import LandCoverClassifier, ChangeDetector

# Land cover classification
classifier = LandCoverClassifier(n_classes=9)
classifier.build_model(input_shape=(14,))
classifier.train(X_train, y_train)

# Change detection
detector = ChangeDetector(method='difference')
changes = detector.detect_changes(image1, image2, threshold=0.2)

Utilities (deepgee.utils)

from deepgee import (
    load_geotiff, save_geotiff, calculate_area_stats,
    plot_confusion_matrix, plot_classification_map
)

# Load/save data
image, meta = load_geotiff('input.tif')
save_geotiff(output, 'output.tif', meta)

# Calculate statistics
stats = calculate_area_stats(classified, class_names, pixel_size=30)

# Visualize
plot_classification_map(classified, class_names, class_colors)

📖 Documentation

Full documentation available at: https://deepgee.readthedocs.io/

🎯 Use Cases

1. Land Cover Classification

Classify satellite imagery into multiple land cover types using deep learning.

2. Crop Monitoring

Monitor crop health and predict yields using time series analysis.

3. Change Detection

Detect changes in land cover over time for deforestation, urbanization, etc.

4. Disaster Response

Rapid assessment of flood extent, fire damage, or other disasters.

5. Urban Planning

Extract building footprints and monitor urban growth.

🤝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

📄 License

This project is licensed under the MIT License - see LICENSE file for details.

🙏 Acknowledgments

  • Google Earth Engine team for the amazing platform
  • geemap developers for the excellent Python package
  • TensorFlow/Keras teams for deep learning frameworks

📧 Contact

🌟 Citation

If you use DeepGEE in your research, please cite:

@software{deepgee2024,
  title={DeepGEE: Earth Observation with Google Earth Engine and Deep Learning},
  author={Pulakesh Pradhan},
  year={2024},
  url={https://github.com/pulakeshpradhan/deepgee}
}

Made with ❤️ for the Earth Observation community

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

deepgee-0.1.0.tar.gz (17.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

deepgee-0.1.0-py3-none-any.whl (16.7 kB view details)

Uploaded Python 3

File details

Details for the file deepgee-0.1.0.tar.gz.

File metadata

  • Download URL: deepgee-0.1.0.tar.gz
  • Upload date:
  • Size: 17.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for deepgee-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c034bf3e3954cd72ec557bac11f3490b98def1d3d98f6b2125bb971f1472f5b4
MD5 e4ed50b1e1cea77311dfbd3ea580600f
BLAKE2b-256 3cb8c8a10d431a7fdc4e6ad42f45cc8e7093c89d6c3b6b059fef9686c39eaa63

See more details on using hashes here.

File details

Details for the file deepgee-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: deepgee-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for deepgee-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 68a74435cc8da8d53cdd5bf668fe862213790069456307a005eb52ea1d1f2031
MD5 43a7e0a825c298846275f03f11a1c2c3
BLAKE2b-256 6b6c7ac66bb4958e5813ff92005951eec29d52b01776e834c858358350081b70

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page