-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcommands.sh
92 lines (43 loc) · 3.46 KB
/
commands.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
#@IgnoreInspection BashAddShebang
# A record of often-used bash commands.
# Add ai4eutils to PYTHONPATH
export PYTHONPATH=${PYTHONPATH}:/home/<username>/wcs/repos/ai4eutils
# Tiling and masking the 2013-2014 set
python data/3_tile_and_mask.py \
--image_path /home/<username>/wcs/mnt/wcs-orinoquia/images_sr_median/2013_2014 \
--label_path /home/<username>/wcs/mnt/wcs-orinoquia/provided_labels/Landuse_shape/derived_20200421/landuse.shp \
--label_property Landuse_WC \
--out_dir /home/<username>/wcs/mnt/wcs-orinoquia/tiles/full_sr_median_2013_2014 \
--region_outline /home/<username>/wcs/mnt/wcs-orinoquia/misc/outline/Orinoquia_outline.shp
# Training locally on a DSVM
conda activate wcs
export PYTHONPATH="${PYTHONPATH}:/home/<username>/wcs/pycharm"
cd training
sh run_training_local.sh
# Scoring
# modify selection of tiles at the top of inference.py
checkpoint_path=/home/boto/wcs/mnt/wcs-orinoquia/useful_checkpoints/wcs_coarse_baseline/wcs_coarse_baseline_epoch93_best.pth.tar
out_dir=/home/boto/wcs/mnt/wcs-orinoquia/delivered/20201221_timepoints/2017_2018
python training_wcs/scripts/inference.py --config_module_path training_wcs/experiments/coarse_baseline/coarse_baseline_config.py --checkpoint_path ${checkpoint_path} --out_dir ${out_dir}
# Post-processing
python data/postprocess_model_output.py --model_output_dir .../Data/WCSColombia/delivered/20200715/results_coarse_baseline_201920 --output_dir .../Data/WCSColombia/delivered/20200715/results_coarse_baseline_201920_polygons_filtered7 --radius 7
# Combine output raster tiles into a .vrt
gdalbuildvrt .../Data/WCSColombia/delivered/20200715/results_coarse_baseline_201920_polygons_filtered7/po_res_wcs_orinoquia_sr_median_2019_202004.vrt .../Data/WCSColombia/delivered/20200715/results_coarse_baseline_201920_polygons_filtered7/*.tif
# Mounting blob container
sh mount_wcs_containers.sh
OR
sudo mkdir /mnt/blobfusetmp-wcs-orinoquia
sudo chown USERNAME /mnt/blobfusetmp-wcs-orinoquia
blobfuse /home/<usrname>/wcs/mnt/wcs-orinoquia --tmp-path=/mnt/blobfusetmp-wcs-orinoquia --config-file=wcs-orinoquia.cfg -o attr_timeout=240 -o entry_timeout=240 -o negative_timeout=120 -o allow_other
# Copy data to disk for faster access
azcopy cp "https://geospatialmldata.blob.core.windows.net/wcs-orinoquia/tiles/full_sr_median_2013_2014/tiles?SAS_KEY" /disk/wcs_data/tiles/full_sr_median_2013_2014 --recursive
azcopy cp "https://geospatialmldata.blob.core.windows.net/wcs-orinoquia/tiles/full_sr_median_2013_2014/tiles_masks?SAS_KEY" /disk/wcs_data/tiles/full_sr_median_2013_2014 --recursive
azcopy cp "https://geospatialmldata.blob.core.windows.net/wcs-orinoquia/tiles/full_sr_median_2013_2014/tiles_masks_coarse?SAS_KEY" /disk/wcs_data/tiles/full_sr_median_2013_2014 --recursive
Elevation data:
azcopy cp "https://geospatialmldata.blob.core.windows.net/wcs-orinoquia/images_srtm?SAS_KEY" /disk/wcs_data --recursive
# Rasterize polygons of corrected labels
# The corrected windows still uses "model_pred" as the field with the category information
# Pixel Size = (0.000269494585236,-0.000269494585236) read from previous rasters
gdal_rasterize -a model_pred -a_nodata 0 -ot Byte -tr 0.000269494585236 0.000269494585236 -co COMPRESS=LZW /Users/siyuyang/Data/WCSColombia/provided_labels/Landuse_corrections_Felipe/Results_Corrected/WINDOW_ID_1.shp /Users/siyuyang/Data/WCSColombia/provided_labels/Landuse_corrections_Felipe/results_corrected_raster/window_1.tif