- Clone the github repository to your local machine.
git clone [email protected]:byurk/model-dune.git
-
Open up the project by navigating inside the directory and click
model-dune.Rproj
. -
Check for any warnings for missing dependencies that you might have to install.
Done! Now you should be able to run the code in the project.
The project is organized into the following directories:
-
code - Contains the modeling code in R scripts and quarto documents.
-
raw_data - Contains the features/images for the ground-based model and orthomosaic data for the drone-based model.
-
clean_data - Contains the classified images, the extracted pixels for training data, features for the orthomosaic.
-
outputs - Vegetation density map of the dune complex.
You should either create the raw_data, clean_data, and outputs directories and/or create symlinks to these directories (probably somewhere on Google Drive).
-
The training data for the ground-based model was extracted using labelme
- In the 50 RGB photographs (the 50 quadrats) polygons were drawn of the different surface compositions (sand, grass, dead vegetation, etc.) Each quadrat directory has a
polygons.json
file with the associated geometries and class labels. - The script
code/src/sample-all-ground-pixels.R
extracts the pixels from the polygons and saves them as a.rds
file in theclean_data
directory.
- In the 50 RGB photographs (the 50 quadrats) polygons were drawn of the different surface compositions (sand, grass, dead vegetation, etc.) Each quadrat directory has a
-
The ground-based model performs pixel based classification in the ground based imagery as grass, dead vegetation, and sand. The quarto document
code/ground-based-model.qmd
contains the code for this model.
- The model chosen is an xGBoost model, but any model can be used.
- Save the workflow and model (using tidymodel conventions) in
clean_data
. - Run the script
code/src/classify-all-images.R
to classify all the images in theraw_data
directory and save the classified images in theclean_data
directory. This will save the classified quadrats inside a folder named after the model.
- Once a model is selected and the quadrats are classified, the drone-based model can be trained. The drone-based model uses the classified quadrats to predict the surface composition of the entire orthomosaic map. The quarto document
code/drone-based-model.qmd
contains the code for this model.
- The model chosen is a multinomial regression with regularization, but any model can be used.
- First run
code/src/generate-orthomsaic-features.R
to extract the features from the orthomosaic and save them in theclean_data
directory. - Next, run
code/src/create-training-set.R
to createtraining.rds
that contains coverage estimates from the close-up quadrats and the multispectral data from the drone-based quadarts. - Fit the multinomial regression model using data from
training.rds
. - Save the workflow and model (using tidymodel conventions) in
clean_data
. - Run the script
code/src/predict-orthomosaic.R
to predict the surface composition of the entire orthomosaic map and save the map in theoutputs
directory.
Explore the training/testing data, follow single photograph (quadrat) through the ground-based model and the drone-based model.
Pixel based classification of ~50 close up photographs of Saugatuck Harbor Natural Area (SHNA) sand dune.
Multinomial regression with regularization predicting surface composition estimates from the ground-based model using multispectral drone imagery of SHNA.
Predicting surface composition across the entire stitched orthomosiac map of SHNA.