Skip to main content

Geospatial (especially Multi-Spectral) support for fastai

Project description

Welcome to fastgs

Introduction

This library is currently in alpha, neither the functionality nor the API is stable

This library provides geospatial multispectral image support for fastai. FastAI already has extensive support for RGB images in the pipeline. I try to achieve feature parity for multi-spectral images with this library, specifically in the context of Sentinel 2 geospatial imaging.

Install

pip install -Uqq fastgs
conda install -c restlessronin fastgs

How to use

The low-level functionality is wrapped into a class that loads sets of Sentinel 2 channels into a multi-spectral tensor (a TensorImageMS subclass of fastai TensorImage which itself is a subclass of the pytorch Tensor).

from fastgs.geospatial.sentinel import *

The following code creates a class that can load 11 Sentinel 2 channels into a TensorImageMS.

from fastgs.vision.testio import * # defines read_multichan_files_as_tensor

snt_12 = Sentinel2(
    ["B02","B03","B04","B05","B06","B07","B08","B8A","B11","B12","AOT"],
    [Sentinel2.natural_color, ["B07","B06","B05"],["B12","B11","B8A"],["B08"]],
    get_channel_filenames,
    read_multichan_files,
    read_mask_file
)

The second parameter is a list of 4 channel sets that are minimally required to visualize all the individual channels.

img_12 = snt_12.load_tensor(66)
img_12.show()
[<AxesSubplot:>, <AxesSubplot:>, <AxesSubplot:>, <AxesSubplot:>]

Acknowledgements

This library is inspired by the following notebooks (and related works by the authors)

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

fastgs-0.0.11.tar.gz (13.3 kB view hashes)

Uploaded Source

Built Distribution

fastgs-0.0.11-py3-none-any.whl (14.0 kB view hashes)

Uploaded Python 3

Supported by

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