Skip to content

Commit 509d001

Browse files
committed
initial commit with code used to obtain 1st version of paper results
1 parent c7bfca5 commit 509d001

File tree

79 files changed

+71367
-2
lines changed

Some content is hidden

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

79 files changed

+71367
-2
lines changed

README.md

+37-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,37 @@
1-
# optimal-multiview-crop-classifier
2-
Public repository of our work "IN THE SEARCH FOR OPTIMAL MULTI-VIEW LEARNING MODELS FOR CROP CLASSIFICATION WITH GLOBAL REMOTE SENSING DATA"
1+
# In the search for an optimal multi-view crop classifier
2+
Public repository of our work "IN THE SEARCH FOR OPTIMAL MULTI-VIEW LEARNING MODELS FOR CROP CLASSIFICATION WITH GLOBAL REMOTE SENSING DATA"
3+
4+
> Now we have created a package to use multi-view learning models in a easy way in PyTorch: [https://github.com/fmenat/mvlearning](https://github.com/fmenat/mvlearning)
5+
6+
## Data
7+
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
8+
9+
### Training
10+
* To train the Input fusion strategy:
11+
```
12+
python train_singleview.py -s config/singleview_ex.yaml
13+
```
14+
* To train the Ensemble aggregation strategy:
15+
```
16+
python train_singleview_pool.py -s config/singleviewpool_ex.yaml
17+
```
18+
* To train strategies based on multiple encoders: Feature, Decision and Hybrid fusion strategies:
19+
```
20+
python train_multiview.py -s config/multiview_ex.yaml
21+
```
22+
23+
### Evaluation
24+
* To evaluate the model by its predictions (performance):
25+
```
26+
python evaluate_predictions.py -s config/evaluation_ex.yaml
27+
```
28+
29+
30+
## Installation
31+
Please install the required packages with the following command:
32+
```
33+
pip install -r requirements.txt
34+
```
35+
36+
## Source
37+
Preprint: Mena, Francisco, Diego Arenas, and Andreas Dengel. "*In the Search for Optimal Multi-view Learning Models for Crop Classification with Global Remote Sensing Data.*" [arXiv preprint arXiv:2403.16582](https://arxiv.org/abs/2403.16582) (2024).

config/MV_Input_ex.yaml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
output_dir_folder: /home/mena/Documents/PhD/views_23/views_analysis_IGARSSext/outputs_test
2+
input_dir_folder: /home/mena/Documents/PhD/views_23/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+
34+
# model_type: tae
35+
# dropout: 0.2
36+
# #default values:
37+
# layer_sizes: [512, 128] #256-128 in LTAE and 512-128-128 in TAE
38+
# d_k: 8 #8 in LTAE and 32 in TAE
39+
# n_head: 4 #16 in LTAE and 4 in TAE
40+
# d_model: 128 #256 in LTAE and None in TAE, test with 128
41+
42+
# model_type: tempcnn
43+
# dropout: 0.2
44+
# kernel_size: 5 #default value: 5
45+
# layer_size: 64 #default value: 64
46+
# n_layers: 3 #default value: 3
47+
predictive_model:
48+
n_layers: 1
49+
layer_size: 64
50+
dropout: 0.2
51+
batchnorm: True

config/MV_decision_ex.yaml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
output_dir_folder: /home/mena/Documents/PhD/views_23/views_analysis_IGARSSext/outputs_test
2+
input_dir_folder: /home/mena/Documents/PhD/views_23/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: False
68+
agg_args:
69+
mode: avg
70+
adaptive: False

config/MV_decision_gated_ex.yaml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
output_dir_folder: /home/mena/Documents/PhD/views_23/views_analysis_IGARSSext/outputs_test
2+
input_dir_folder: /home/mena/Documents/PhD/views_23/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: False
68+
agg_args:
69+
mode: avg
70+
adaptive: True
71+
features: True

config/MV_decision_gatedloss_ex.yaml

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
output_dir_folder: /home/mena/Documents/PhD/views_23/views_analysis_IGARSSext/outputs_test
2+
input_dir_folder: /home/mena/Documents/PhD/views_23/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: False
72+
agg_args:
73+
mode: avg
74+
adaptive: True
75+
features: True

config/MV_decision_multiloss_ex.yaml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
output_dir_folder: /home/mena/Documents/PhD/views_23/views_analysis_IGARSSext/outputs_test
2+
input_dir_folder: /home/mena/Documents/PhD/views_23/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: False
72+
agg_args:
73+
mode: avg
74+
adaptive: False

0 commit comments

Comments
 (0)