Model to classify direct deforestation drivers in Cameroon.
# Cam-ForestNet
Model to classify direct deforestation drivers in Cameroon.
Folders
------
- 'model': This folder contains the classification model and most of the code was written by Irvin et al. (2020). Our changes are all identified with *#AD* in the code. These changes were made to adapt the model for our case study/different types of input data/different tests for improvements including data fusion and time series analysis.
- 'prepare_files': This folder contains all of the steps needed to build our reference dataset.
- 'environments': This folder contains the environments needed to run the model or steps in 'prepare_files'. See below the use for each task.
Guidelines for use
------
1. Download 'model' locally and the fnet environment
3. Download datasets and unzip in model>data>ForestNetDataset:
zenodo.org
4. Choose the csv file for the wanted approach and sensor and add in model>data>ForestNetDataset
5. Run:
a) Train from scratch
`conda activate fnet`
`python3 main_mytrain_all.py train --exp_name test_exp --gpus [0] --data_version ls8_dynamic --merge_scheme four-class --resize aggressive --spatial_augmentation affine --pixel_augmentation hazy --model EfficientNet-b2 --architecture FPN --loss_fn CE --gamma 10 --alpha 10 --late_fusion True --late_fusion_stats True --late_fusion_aux_feats True --late_fusion_ncep True --late_fusion_embedding_dim 128 --late_fusion_dropout 0.1`
`ulimit -n 4096`
`python3 main_mytest_all.py test --ckpt_path models/sandbox/test_exp/ckpts/epoch=xx-val_f1_macro=xx.ckpt`
**Note 1: Fill out xx values with the best epoch by examining the sandbox**
**Note 2: Possibility to choose timeseries or fusion approach too by changing the .py file used**
b) Use the trained model
Best performing option for Landsat-8:
Download .ckpt file in a sandbox>test_exp>ckpts folder
`ulimit -n 4096`
`python3 main_mytest_all.py test --ckpt_path models/sandbox/test_exp/ckpts/epoch=63-val_f1_macro=0.8050.ckpt`
Best performi …