Git Product home page Git Product logo

landsat's Introduction

Landsat classification suite

General capabilities

  • Landsat L5, L7, L8 atmospheric convertion based on stored metadata
  • Landsat band aggregation into multi-layer TIFFs
  • Collection of training data from mult-layer Landsat TIFF images using the mapping of coordinates to images and classes
  • Training and validating a Tensorflow based classifier for Landsat landcover
  • Classification of full or partial multi-layer Landsat TIFF images into classification maps

End-to-end run-through

Collect data from sources: images for training and final output as well as training data by extracting converted data from images at the locations provided in the training data set.

Place source Landsat images for training data with all single-band tiffs and metadata in a directory per image, e.g. under /Volumes/Caffeine/Data/Landsat/sources/training. Do the same for images you want to classify placing those e.g. under /Volumes/Caffeine/Data/Landsat/sources/prod.

Place directories with coordinates of points for training data e.g. under /Volumes/Caffeine/Data/Landsat/sources/training-coordinates.

Now run:

mkdir -p /Volumes/Caffeine/Data/Landsat/converted/training
landsat convert -v -s \
  -d /Volumes/Caffeine/Data/Landsat/sources/training \
  -o /Volumes/Caffeine/Data/Landsat/converted/training # compress=deflate zlevel=6 predictor=3

mkdir -p /Volumes/Caffeine/Data/Landsat/converted/prod
landsat convert -v -s \
  -d /Volumes/Caffeine/Data/Landsat/sources/prod \
  -o /Volumes/Caffeine/Data/Landsat/converted/prod # compress=deflate zlevel=6 predictor=3

mkdir -p /Volumes/Caffeine/Data/Landsat/trainingdata
landsat field /Volumes/Caffeine/Data/Landsat/sources/training-coordinates \
  -d /Volumes/Caffeine/Data/Landsat/converted/training \
  -o /Volumes/Caffeine/Data/Landsat/trainingdata

Train the model by running the python script tensorflow/train_save_model.py.

Run the classification of all images:

mkdir -p /Volumes/Caffeine/Data/Landsat/classification
for TIFFNAME in /Volumes/Caffeine/Data/Landsat/converted/prod/*.tiff; do
  echo $TIFFNAME
  landsat predict -v "$TIFFNAME" \
    -m /Volumes/Caffeine/Data/Landsat/tf.model \
    -o /Volumes/Caffeine/Data/Landsat/classification
done

Installation

Dependencies and Requirements

  • Languages Go and python (for training the Tensorflow model only)
  • libgdal with libtiff support for operating with Landsat images and for creating classification maps
  • libtensorflow for performing the classification
  • tensorflow python package for training the classifier

Building on OSX M1 (arm64 arch)

Add LIBRARY_PATH and DYLD_LIBRARY_PATH to IntelliJ settings.

brew install tensorflow
brew install protobuf
brew install swig

export LIBRARY_PATH=/opt/homebrew/lib
export DYLD_LIBRARY_PATH=/opt/homebrew/lib

git clone --branch v2.9.0 https://github.com/tensorflow/tensorflow.git ${GOPATH}/src/github.com/tensorflow/tensorflow
# v2.8.1 has a broken protobuf dependency and needs to be fixed with a cherry pick:
# git cherry-pick --strategy-option=no-renames --no-commit 65a5434

cd ${GOPATH}/src/github.com/tensorflow/tensorflow
go mod init github.com/tensorflow/tensorflow
(cd tensorflow/go/op && go generate)
go mod tidy

go test ./...

On OSX arm64 this conflicts with tensorflow from brew, so make sure that LIBRARY_PATH and DYLD_LIBRARY_PATH are unset when operating with the python library:

brew install miniforge

conda create --name landsat python=3.10.2
conda activate landsat
conda install -c apple tensorflow-deps==2.9.0

conda install -c apple pandas tensorflow-deps tensorflow

References used in setting up

landsat's People

Watchers

Oleg Sklyar 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.