Code Monkey home page Code Monkey logo

crop-mask's Introduction

Crop Map Generation

Status Status

End-to-end workflow for generating high resolution cropland maps.

Contents

Creating a crop map

To create a crop map run the following colab notebook: Open In Colab

Cropland gif

Training a new model

To train a new model run the following colab notebook (or use it as a guide): Open In Colab

Two models are trained - a multi-headed pixel wise classifier to classify pixels as containing crop or not, and a multi-spectral satellite image forecaster which forecasts a 12 month timeseries given a partial input:

models

Adding new labeled data

Open In Colab To add new labeled data follow the OpenMapFlow documentation OR run the linked colab notebook.

Setting up a local environment

Ensure you have anaconda installed.

1. For development

Ensure you have gcloud installed.

conda install mamba -n base -c conda-forge  # Install mamba
mamba env create -f environment-dev.yml     # Create environment with mamba (faster)
conda activate landcover-mapping            # Activate environment
gcloud auth application-default login       # Authenticates with Google Cloud
pre-commit install                          # Setup automatic linting on every commit
pre-commit run --all-files                  # Run linting on all files

2. For shapefile notebook

conda env create -f environment-lite.yml    # Create environment
conda activate landcover-lite               # Activate environment
jupyter notebook

Tests

The following tests can be run against the pipeline:

flake8 . # code formatting
mypy .  # type checking
python -m unittest # unit tests

# Integration tests
python -m unittest test/integration_test_model_bbox.py
python -m unittest test/integration_test_model_evaluation.py

Steps to resolve module related issues on a Windows environment

I]Steps to resolve the issue related with 'fiona' and 'geopandas' module

pip uninstall geopandas  #if the package is already installed in the environment
pip install pipwin
pipwin install gdal
pipwin install fiona
pip install geopandas


II]Steps to resolve the issue related with 'netcdf' module

pip uninstall netcdf4
pip install netcdf4


III]Steps to resolve the warning encountered with the 'pyproj' module
mamba remove pyproj or pip uninstall pyproj
pip install pyproj

Previously generated crop maps

Google Earth Engine:

Zenodo

Reference

If you find this code useful, please cite the following paper:

Gabriel Tseng, Hannah Kerner, Catherine Nakalembe and Inbal Becker-Reshef. 2020. Annual and in-season mapping of cropland at field scale with sparse labels. Tackling Climate Change with Machine Learning workshop at NeurIPS โ€™20: December 11th, 2020

crop-mask's People

Contributors

ivanzvonkov avatar dataset-bot avatar adebowaledaniel avatar pre-commit-ci[bot] avatar mspixels avatar bhyeh avatar hannah-rae avatar adamy03 avatar aniket-parlikar avatar evamutz avatar gabrieltseng avatar ahong8595 avatar imanasmith avatar logdaye avatar gedeon-m-gedus avatar maryannvaz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.