Skip to content

3_What to do

dbuscombe-usgs edited this page Nov 27, 2022 · 2 revisions

🌈 What to do

Example imagery

If you need some sample imagery to work with, from the root directory,

cd utilities
python download_sample_data.py

It will create the folder sample_data if it doesn't already exist, then download the sample data of the dataset you choose from the drop-down menu

To create 5-band inputs, use utilities/merge_nd_inputs4pred.py. To create MNDWI imagery, use utilities/make_mndwi_4pred.py or to create NDWI imagery, use utilities/make_ndwi_4pred.py. Follow the prompts asking for various inputs, and the program will create .npz format files containing imagery. You may subsequently use these .npz format files for prediction. Note that this is not necessary for 3-band jpeg images.

Segment imagery (apply model to sample imagery)

From the root directory,

cd scripts
python select_model_and_batch_process_folder.py

It will create the folder downloaded_models if it doesn't already exist, then download the model of the dataset you choose from the first drop-down menu if that doesn't already exist. Then you are prompted to choose a dataset, which relates to the type of imagery the model was trained using and what the model should be applied to. If you choose the dataset 'ALL', the program will download models for all imagery types and then exit. Otherwise, select your imagery type from the menu.

In the next menu, select 'BEST' to apply only the best model, or 'ENSEMBLE' to create an ensemble prediction. We usually would recommend an ensemble model, however you should determine which is best for your task.

The final menu asks you to select a directory of sample images (or npzs) to segment. Model outputs are written to a subdirectory of the sample imagery called 'out'.