Geospatial Deep Learning resources & study group

Did anyone participate in the Open AI Caribbean Challenge hosted by DrivenData ?
I am looking to discuss for a better solution and expand my knowledge if anyone participated.
I scored 11th position and really happy about it as this was my first ever competition!
All thanks to @daveluo and his notebooks which helped me throughout.

6 Likes

I came 21st, wasn’t able to do any work on it for the past three weeks :frowning: (actually had time again this morning, but comp closed) so fairly happy with result.
Fastai codebase, resnet, densenet, efficientnets

For me too, thanks to @daveluo for intro to solaris and rasterio which was critical to dataprep.

3 Likes

Congrats @chaitanyaarora and @adrian on your excellent results!

Glad to hear my work could be of help. I didn’t participate in the Caribbean challenge but am interested to learn more about your approaches, especially re: your geodata preprocessing and if/how you’ve adapted fastai from stock usage.

For a new geospatial ML challenge to dive into, check out:

Just launched, running to 3/16/2020. Also by DrivenData along with Azavea and GFDRR Labs.

$15K in prizes across 2 tracks:

  1. Semantic Segmentation track: $12K for top 3 open-source building segmentation models developed on an extensive and diverse new dataset of drone imagery and OpenStreetMap building footprints from 10+ African cities/regions:

  1. Responsible AI track: $3K for top 3 ideas/projects examining the applied ethics in developing and using AI systems for disaster risk management. Very open submission format - can submit anything from Jupyter notebooks to speculative fiction - and you’re not required to also participate in the segmentation track. Segmentation participants do have to submit at least once to this in order to qualify for the cash prizes in that track.

I’m one of the challenge organizers so let me know on the participants’ forum if you have any specific questions!

4 Likes

Thanks for the heads up on the challenge, may be able to find some time to have a go.

My approach for the Caribbean challenge was:

Rasterio to crop tif for each roof polygon to its own image. Use cv border or reflect to pad to square.
Try different transforms in fastai, basic crop, rotate, zoom, brightness worked best.
Predict roof type using resnet50, (using all data) densenet121,efficientnet. Use means ensembling. This base approach got me best result.

Other approaches:
Pred rooftype+region (concatenate class names)/pred roof type +country.
Pred the non verified data (2 regions), then use the results that a bunch of models all predict same class with say a 80% cutoff. Use these preds for training + verified data.
Ricap/mixup/cutmix -didnt work well
Even up class imbalance-didnt help
Autodetect blurry images and sharpen-didnt help.
Imgaug transforms.
Predicting test data then adding confident preds to training data.

There was spatial component to roof types per tiff that i thought could help but xy too difficult for neural net to predict, and didnt find a good way to add spatial distribution to models.

2 Likes

For the Caribbean challenge my approach which worked best was:

  1. Cropping data using Rasterio as in this notebook
  2. Training and testing on 3 different models using resnet50 for each country individually
    a. For Colombia used normal approach to train data
    b. For Guatemala as there was no image in incomplete class i assigned 0 to it while testing and classified my images in 4 classes only
    c. For St. Lucia i over fitted my training data using all the images provided for the country

Things that did not work for me:

  1. Normalizing the number of images in each class to be identical by rotating/changing colors so that my model is not biased towards a particular class.
  2. Setting up a single model for whole of my training data.
  3. Cropping images using the mask method in rasterio with crop=True
  4. Over fitting my model for the other two countries
  5. Manually classifying the most confused images
4 Likes

I just posted this (Share your work here ✅) but I figured I should also share it here :slight_smile:

Article: https://authors.elsevier.com/a/1aN0a3I9x1YsQn
Code and data: https://github.com/mnpinto/banet

Feel free to ask me more about this work! :slight_smile:

Edit: Updated the sharing link that allows for free access up to 27 February.

5 Likes

This might be interest claiming some state of art results.
HMANet: Hybrid Multiple Attention Network for Semantic Segmentation in Aerial Images

1 Like

This is awesome. Thanks for sharing and congrats on the research results and publication! Really interesting approach to unet segmentation with separate spatial and temporal convs + LSTM module…

Would be curious to see how well this does for land cover mapping and change detection more generally (i.e. on sentinel 2 or landsat images over multiple seasons/years). Have you given anything like that a go?

Not quite the same but ICYMI, you may find this new IEEE GRSS Data Fusion competition interesting…land cover classification with low-res labels: http://www.grss-ieee.org/community/technical-committees/data-fusion/

2 Likes

Thanks! It may also work well for land cover mapping but I never tried it. Sentinel 2/Landsat images are quite a challenge due to the huge volume of data. I’m working on a desktop computer with a GTX 1080 so moving to high-res is not very feasible for now.

The Data Fusion competition looks interesting, thanks for sharing :slight_smile:

2 Likes

This is pretty awesome https://arxiv.org/abs/2001.01306
With competition https://www.agriculture-vision.com/
(Via the excellent https://jack-clark.net/)

2 Likes

Found cesium to be very useful. Posting here , if useful for anybody else. thanks

3 Likes

Hi Dave and thank you for a great tutorial,

At this time 1/15/2020, I’m having an issue following your colab notebook, that:

!add-apt-repository ppa:ubuntugis/ppa
!apt-get update
!apt-get install python-numpy gdal-bin libgdal-dev
!apt install python3-rtree

!pip install rasterio
!pip install geopandas
!pip install descartes
!pip install solaris
!pip install rio-tiler

will give this error installing solaris’ dependencies:

Building wheels for collected packages: gdal, pyyaml, albumentations, rio-cogeo, rtree, imgaug, supermercado
  Building wheel for gdal (setup.py) ... error
  ERROR: Failed building wheel for gdal
  Running setup.py clean for gdal
  Building wheel for pyyaml (setup.py) ... done
  Created wheel for pyyaml: filename=PyYAML-5.2-cp36-cp36m-linux_x86_64.whl size=44209 sha256=0a254364d86135d369e2688fe7161e44229c9a776254b4de37c62ef0191a1694
  Stored in directory: /root/.cache/pip/wheels/54/b7/c7/2ada654ee54483c9329871665aaf4a6056c3ce36f29cf66e67
  Building wheel for albumentations (setup.py) ... done
  Created wheel for albumentations: filename=albumentations-0.4.3-cp36-none-any.whl size=60764 sha256=edd15b9c26f06bf09b3c4c7458a007bc23a119f5038c65af56d776e3ce9f6447
  Stored in directory: /root/.cache/pip/wheels/20/16/8e/d3bec34bf30adff30929226f0b83cc8c005b5af131f51db9d0
  Building wheel for rio-cogeo (setup.py) ... done
  Created wheel for rio-cogeo: filename=rio_cogeo-1.1.8-cp36-none-any.whl size=17085 sha256=423bb51a6765f9faf0341dc67c6cf3f6f8d8106a2cfb385e1ffd681e510f006d
  Stored in directory: /root/.cache/pip/wheels/65/61/bb/57962da75239cb8f3bfef62b6f3e4f4a7dfeec2de3bc89995e
  Building wheel for rtree (setup.py) ... done
  Created wheel for rtree: filename=Rtree-0.9.3-cp36-none-any.whl size=21264 sha256=17ed3a8fcdd85f978155ec00cc16511a0381c20eab20be16936083161eff8a7d
  Stored in directory: /root/.cache/pip/wheels/0b/f6/58/2d819b2abdc280c3f70db0b0ce86a712839267957db7abad85
  Building wheel for imgaug (setup.py) ... done
  Created wheel for imgaug: filename=imgaug-0.2.6-cp36-none-any.whl size=654020 sha256=57ce9ae943c6600810474c25ffe411eb676a4bcce1a9ffddef7a89d42773faa8
  Stored in directory: /root/.cache/pip/wheels/97/ec/48/0d25896c417b715af6236dbcef8f0bed136a1a5e52972fc6d0
  Building wheel for supermercado (setup.py) ... done
  Created wheel for supermercado: filename=supermercado-0.0.5-cp36-none-any.whl size=7088 sha256=4fb7e76c6879b78d301a1979ed8c30acfcfb14f330b60cf51c1fdf579504c1b9
  Stored in directory: /root/.cache/pip/wheels/9b/2f/8e/011d7ab17b423894b4b358204c0bb854a8bb8de199e9f98f30
Successfully built pyyaml albumentations rio-cogeo rtree imgaug supermercado
Failed to build gdal
ERROR: kaggle 1.5.6 has requirement urllib3<1.25,>=1.21.1, but you'll have urllib3 1.25.7 which is incompatible.
ERROR: google-colab 1.0.0 has requirement requests~=2.21.0, but you'll have requests 2.22.0 which is incompatible.
ERROR: datascience 0.10.6 has requirement folium==0.2.1, but you'll have folium 0.8.3 which is incompatible.
Installing collected packages: tqdm, gdal, urllib3, requests, pyyaml, imgaug, albumentations, mercantile, supermercado, rio-cogeo, tensorboard, mock, tensorflow-estimator, tensorflow, rtree, solaris
  Found existing installation: tqdm 4.28.1
    Uninstalling tqdm-4.28.1:
      Successfully uninstalled tqdm-4.28.1
  Found existing installation: GDAL 2.4.2
ERROR: Cannot uninstall 'GDAL'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

There might be some change in the dependencies that make it doesn’t work any more. Can you have a check please?

Thank you.

We should create fastai2.geospatial, what do you think?

In the last months that I’ve been working on the burned areas mapping and dating, developing the datasets was the most time-consuming task. There are data from a lot of satellites and sources, different resolutions, timescales and projections. There are data also in shapefile format. All these need to be joined in order to have a dataset to train a model. When I published the code for my article that I shared above I included code to do this kind of processing aiming to make it as easy as possible. I’m now working to further refine my code using nbdev but I realized that maybe it could instead be a good idea to make it a starting point for a fastai2.geospatial module.

The idea would be to have something like:

  • fastai2.geospatial.download -> utility functions to download datasets from several public sources.
  • fastai2.geospatial.data -> scripts to preprocess the data, including coordinate transformation, resampling, handling geotiffs and shapefiles (this part requires libraries like shapely, geopandas, rasterio).
  • fastai2.geospatial.models -> some model architectures specific for geospatial data.

This would then connect to fastai2.vision.

@jeremy, @sgugger do you think this could be a good addition to the library?

10 Likes

Will answer to myself in order that someone else is solving similar challenge :slight_smile: Just found how to use COG https://towardsdatascience.com/access-satellite-imagery-with-aws-and-google-colab-4660178444f5 and in combination with POSTGIS- POSTGRE DB a table with data specific to each training sample (satellite image name, GPS.mask, band,…) could do the job.

3 Likes

@MichaelScofield thanks for the headsup - I’ve updated the notebook to install gdal 3 which is the change in dependency for solaris 0.2.1. The tutorial’s in need of a larger revamp but that should work for a quickfix at the moment. To make the change in your own notebook copy, you can update that cell by changing the apt repo to ubuntugis-unstable and installing gdal 3 with:

!add-apt-repository ppa:ubuntugis/ubuntugis-unstable -y
!apt-get update
!apt-get install python-numpy gdal-bin libgdal-dev python3-rtree

!pip install rasterio
!pip install geopandas
!pip install descartes
!pip install solaris
!pip install rio-tiler

I’ve updated the top wikipost with the latest ongoing and upcoming competitions that have been shared here. Thanks everyone for sharing! Please feel free to make direct edits there as well.

@mnpinto - a geospatial module sounds great. Happy to help, although time is scarce at the moment and I need to get familiar with fastai2 first :). Maybe this is how! My initial take is that the biggest uniquely geospatial hurdle such a module could help fastai users overcome is in the .geospatial.data part you mentioned: wrangling various geodata formats into what we recognize as training images & labels. Maybe we can take some exemplar datasets that differ from each other and are diverse enough cover most use cases and try to get them into fastai2 as cleanly as possible?

6 Likes

I also need to get familiar with fastai2, I guess the 10 walk-thru videos are a good starting point, there are a lot of interesting stuff to dive in. I agree that .geospatial.data can be particularly useful, and I also like the idea of selecting a few datasets to include as benchmarks in fastai2 to make easy to test different models.

2 Likes

You can look at https://github.com/muellerzr/Practical-Deep-Learning-for-Coders-2.0 for a good introduction to fastai2

2 Likes

I just saw the recent Remote Sensing Special Issue called “Image Super-Resolution in Remote Sensing” … there are a few good papers in there that made me curious…

Before diving depper into the topic: Has anybody here applied super resolution to remote sensing images? And has some hints where to start or what works best?

Cheers,
Harry

2 Likes

I haven’t personally worked on superres but found this 4-part writeup from a little while back pretty informative (link goes to part 4, there are links at the beginning to the first 3):

4 Likes

This saves me a lot of testing, thank you very much!

2 Likes