-
Notifications
You must be signed in to change notification settings - Fork 65
/
l8_cloud.sh
executable file
·31 lines (25 loc) · 1.02 KB
/
l8_cloud.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash
# This example trains a Landsat 8 cloud classifier. This classification is
# based on the SPARCS validation data:
# https://www.usgs.gov/core-science-systems/nli/landsat/spatial-procedures-automated-removal-cloud-and-shadow-sparcs
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
if [ ! -f l8cloudmasks.zip ]; then
echo "Downloading dataset."
wget https://landsat.usgs.gov/cloud-validation/sparcs/l8cloudmasks.zip
fi
if [ ! -d sending ]; then
echo "Extracting dataset."
unzip -q l8cloudmasks.zip
mkdir validate
mv sending/LC82290562014157LGN00_24_data.tif sending/LC82210662014229LGN00_18_data.tif validate/
mkdir train
mv sending/*_data.tif train/
mkdir labels
mv sending/*_mask.png labels/
fi
if [ ! -f l8_clouds.h5 ]; then
cp $SCRIPTPATH/l8_cloud.yaml .
delta train --config l8_cloud_dataset.yaml --config l8_cloud_train_network.yaml --config l8_cloud_train_parameters.yaml l8_clouds.h5
fi
delta classify --config l8_cloud_dataset.yaml --image-dir ./validate --overlap 32 l8_clouds.h5