Skip to content

Commit bea6dc4

Browse files
committed
code of igarss publication
1 parent e90560d commit bea6dc4

1,772 files changed

Lines changed: 11744678 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,61 @@
11
# MultiviewCropClassification
22
Code used for the crop classification (CropHarvest) based on multi-view data fusion
3+
4+
5+
### Training
6+
* To train a single-view learning model (e.g. Input-level fusion):
7+
```
8+
python train_singleview.py -s config/singleview_ex.yaml
9+
```
10+
* To train all the views individually with single-view learning (e.g. for single-view predictions or Ensemble-based fusion):
11+
```
12+
python train_singleview_pool.py -s config/singleviewpool_ex.yaml
13+
```
14+
* To train a multi-view learning model (e.g. Feature-level fusion, Decision-level fusion, Gated Fusion, Feature-level fusion with MultiLoss):
15+
```
16+
python train_multiview.py -s config/multiview_ex.yaml
17+
```
18+
19+
### Evaluation
20+
* To evaluate the model by its predictions (performance):
21+
```
22+
python evaluate_predictions.py -s config/evaluation_ex.yaml
23+
```
24+
25+
26+
## Installation
27+
Please install the required packages with the following command:
28+
```
29+
pip install -r requirements.txt
30+
```
31+
32+
> for torch
33+
```
34+
pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113
35+
```
36+
37+
## Data
38+
The data used comes from https://github.com/nasaharvest/cropharvest. However we also share the structures that we used on Google Drive: https://drive.google.com/drive/folders/1aPlctAL8B5dXSdpM55fr3-RUmAHO3quj
39+
40+
41+
## Source
42+
Public repository of our IGARSS 2023 submission.
43+
44+
## Citation
45+
Not yet..
46+
47+
## Licence
48+
Copyright (C) 2022 authors of this github.
49+
50+
This program is free software: you can redistribute it and/or modify
51+
it under the terms of the GNU General Public License as published by
52+
the Free Software Foundation, either version 3 of the License, or
53+
(at your option) any later version.
54+
55+
This program is distributed in the hope that it will be useful,
56+
but WITHOUT ANY WARRANTY; without even the implied warranty of
57+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58+
GNU General Public License for more details.
59+
60+
You should have received a copy of the GNU General Public License
61+
along with this program. If not, see <http://www.gnu.org/licenses/>.

config/evaluation_ex.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
output_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/outputs
2+
input_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/data
3+
4+
data_name: cropharvest_Kenya_maize #options are cropharvest_Kenya_maize, cropharvest_global_crop, cropharvest_togo-eval_crop
5+
6+
methods_to_plot: null #consider all
7+
8+
plot_runs: False

config/multiview_ex.yaml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
output_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/outputs
2+
input_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/data
3+
4+
data_name: cropharvest_togo-eval_crop
5+
6+
training:
7+
max_epochs: 1000
8+
batch_size: 256
9+
emb_dim: 64
10+
early_stop_args:
11+
min_delta: 0.01
12+
mode: min
13+
patience: 5
14+
verbose: True
15+
experiment:
16+
runs: 10 #repetitions
17+
val_size: 0.1
18+
mlflow_runs_exp: True
19+
preprocess:
20+
fillnan: False
21+
flatten: False
22+
form: zscore
23+
24+
save_individually: False #if representations are saved individually -- only for feature based
25+
26+
view_names: ["S2","S1","weather", "VI", "DEM"]
27+
28+
architecture:
29+
encoders:
30+
S1:
31+
model_type: gru
32+
n_layers: 2
33+
layer_size: 64
34+
dropout: 0.2
35+
batchnorm: False
36+
S2:
37+
model_type: gru
38+
n_layers: 2
39+
layer_size: 64
40+
dropout: 0.2
41+
batchnorm: False
42+
weather:
43+
model_type: gru
44+
n_layers: 2
45+
layer_size: 64
46+
dropout: 0.2
47+
batchnorm: False
48+
VI:
49+
model_type: gru
50+
n_layers: 2
51+
layer_size: 64
52+
dropout: 0.2
53+
batchnorm: False
54+
DEM:
55+
model_type: mlp
56+
n_layers: 1
57+
layer_size: 64
58+
dropout: 0.2
59+
batchnorm: False
60+
predictive_model:
61+
n_layers: 1
62+
layer_size: 64
63+
dropout: 0.2
64+
batchnorm: True
65+
66+
method: #fusion method
67+
feature: True
68+
agg_args:
69+
mode: avg
70+
adaptive: True
71+
features: True

config/multiview_multiloss_ex.yaml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
output_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/outputs
2+
input_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/data
3+
4+
data_name: cropharvest_togo-eval_crop
5+
6+
training:
7+
max_epochs: 1000
8+
batch_size: 256
9+
emb_dim: 64
10+
early_stop_args:
11+
min_delta: 0.01
12+
mode: min
13+
patience: 5
14+
verbose: True
15+
loss_args:
16+
multi: True
17+
weights_loss: 0.3
18+
19+
experiment:
20+
runs: 10 #repetitions
21+
val_size: 0.1
22+
mlflow_runs_exp: True
23+
preprocess:
24+
fillnan: False
25+
flatten: False
26+
form: zscore
27+
28+
save_individually: False #if representations are saved individually -- only for feature based
29+
30+
view_names: ["S2","S1","weather", "VI", "DEM"]
31+
32+
architecture:
33+
encoders:
34+
S1:
35+
model_type: gru
36+
n_layers: 2
37+
layer_size: 64
38+
dropout: 0.2
39+
batchnorm: False
40+
S2:
41+
model_type: gru
42+
n_layers: 2
43+
layer_size: 64
44+
dropout: 0.2
45+
batchnorm: False
46+
weather:
47+
model_type: gru
48+
n_layers: 2
49+
layer_size: 64
50+
dropout: 0.2
51+
batchnorm: False
52+
VI:
53+
model_type: gru
54+
n_layers: 2
55+
layer_size: 64
56+
dropout: 0.2
57+
batchnorm: False
58+
DEM:
59+
model_type: mlp
60+
n_layers: 1
61+
layer_size: 64
62+
dropout: 0.2
63+
batchnorm: False
64+
predictive_model:
65+
n_layers: 1
66+
layer_size: 64
67+
dropout: 0.2
68+
batchnorm: True
69+
70+
method: #fusion method
71+
feature: True
72+
agg_args:
73+
mode: avg
74+
adaptive: True
75+
features: True

config/singleview_ex.yaml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
output_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/outputs
2+
input_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/data
3+
4+
data_name: cropharvest_togo-eval_crop
5+
6+
training:
7+
max_epochs: 1000
8+
batch_size: 256
9+
emb_dim: 64
10+
early_stop_args:
11+
min_delta: 0.01
12+
mode: min
13+
patience: 5
14+
verbose: True
15+
experiment:
16+
runs: 10
17+
val_size: 0.1
18+
mlflow_runs_exp: True
19+
preprocess:
20+
fillnan: False
21+
flatten: False
22+
form: zscore
23+
24+
view_names: ["S2","S1","weather", "VI"]
25+
26+
architecture:
27+
encoders:
28+
model_type: gru
29+
n_layers: 2
30+
layer_size: 64
31+
dropout: 0.2
32+
batchnorm: False
33+
predictive_model:
34+
n_layers: 1
35+
layer_size: 64
36+
dropout: 0.2
37+
batchnorm: True

config/singleviewpool_ex.yaml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
output_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/outputs
2+
input_dir_folder: /home/mena/Documents/PhD/MultiviewCropClassification/data
3+
4+
data_name: cropharvest_togo-eval_crop
5+
6+
training:
7+
max_epochs: 1000
8+
batch_size: 256
9+
emb_dim: 64
10+
early_stop_args:
11+
min_delta: 0.01
12+
mode: min
13+
patience: 5
14+
verbose: True
15+
experiment:
16+
runs: 10
17+
val_size: 0.1
18+
mlflow_runs_exp: True
19+
preprocess:
20+
fillnan: False
21+
flatten: False
22+
form: zscore
23+
24+
view_names: ["S2","S1","weather", "VI", "DEM"]
25+
26+
architecture:
27+
encoders:
28+
S1:
29+
model_type: gru
30+
n_layers: 2
31+
layer_size: 64
32+
dropout: 0.2
33+
batchnorm: False
34+
S2:
35+
model_type: gru
36+
n_layers: 2
37+
layer_size: 64
38+
dropout: 0.2
39+
batchnorm: False
40+
weather:
41+
model_type: gru
42+
n_layers: 2
43+
layer_size: 64
44+
dropout: 0.2
45+
batchnorm: False
46+
VI:
47+
model_type: gru
48+
n_layers: 2
49+
layer_size: 64
50+
dropout: 0.2
51+
batchnorm: False
52+
DEM:
53+
model_type: mlp
54+
n_layers: 1
55+
layer_size: 64
56+
dropout: 0.2
57+
batchnorm: False
58+
predictive_model:
59+
n_layers: 1
60+
layer_size: 64
61+
dropout: 0.2
62+
batchnorm: True

0 commit comments

Comments
 (0)