3. Data preparation: Sub-sampling
Reading in data
Surface type
shapefiles
Shapefile
dataframe
(geopandas)
Iterate through
shapefiles/tiffs
Sentinel 1
tiffs
Find associated S1
image
Select random x and y
locations within the S1
image
Quota
Max. tries
Coordinates
Are those coordinates
in a polygon?
Yes
no
Add image size, K, to
coordinates (top left
corner)
Metadata file
(.csv)
Append image index,
x,y coords, label to
metadata
Input
S1 image
(rasterio object)
extract the label from
polygon
Image sub-
sample (.png)
K= 100
K= 100
Add K/2 to x and y to
find center
Output
Samples per label