Farm Pin Crop Detection Challenge
$11,000 USD
Classify fields in South Africa by crop type using Sentinel-2 satellite imagery
4 March–15 September 2019 23:59
726 data scientists enrolled, 42 on the leaderboard
Getting started - masking out the images
published 6 Jun 2019, 12:26

Hey guys :)

I wanted to share some resources for everyone who is struggling to get started. Specifically, the thing that I struggled with the most at first was using the shapefiles to extract the data from the different spectral bands. So I'll try to share with you how I figured that out and hopefully start a discussion where we can share ideas for getting up and running with this comp.

Two disclaimers - 1) that I am TOTALLY new to GIS, so take what I say with a grain of salt 2) I'm not going to give you any code or solutions. In order to learn, we need to struggle a bit, but having someone point you in the right direction can make learning much faster and a lot more fun ;)

Seeing as I'm new to GIS, and that my main goal with competing on Zindi is to learn cool new stuff, I started off by doing a short course on GIS for Python (link below). This course really helped me grep the basics, like coordinate systems (which came in handy), and the tools available in this ecosystem.

Specifically, on the 5th day (dont skip there though) they teach you how to mask a raster using rasterio. That is exactly what you want to do in the case of this competition, so pay careful attention here. For some more info, I've added a link to the documentation on rasterio's webpage for how to mask a raster.

Try those things and you should be able to get the raw pixel values of of each of the spectral bands as numpy arrays. What you do with those numpy arrays is up to you, and IMO the most fun part of all of this.

Good luck and pop a reply if this helped you get started ^_^

Intro to GIS Course:

Masking example:

Great thank you very much.

edited 7 days later

Thanks Renier

edited 4 minutes later

Thanks @RenierBotha, I have a question, were you able to crop the masks? When I do this :-

mask(src, [new_polygon], crop=True)

where crop = True I get the following error:

Input shapes do not overlap raster.

Note: The CRS of both the src and shapefile have been converted to be the same.