Skip to content

Commit 7753953

Browse files
Merge pull request #1 from moienr/dev-SSCL-SoilNet
Dev sscl soil net
2 parents 9d2125a + 0a4bb09 commit 7753953

File tree

125 files changed

+254276
-1588
lines changed

Some content is hidden

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

125 files changed

+254276
-1588
lines changed

.gitignore

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1-
**/__pycache__/
1+
**/__pycache__/
2+
results_physics/*
3+
results_simclr/*
4+
results/*
5+
results_simclr_lucas/*
6+
*.tif

Accuracy_assessment.ipynb

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@
8383
"outputs": [],
8484
"source": [
8585
"# Read the CSV file which is first setup: Base\n",
86-
"df = pd.read_csv('...')\n",
86+
"# df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\RUN_D_2023_06_02_T_20_57_Nafiseh.csv')\n",
87+
"df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\onlytest_D_2023_06_06_T_09_56_Nafiseh.csv')\n",
8788
"\n",
8889
"y_true = df['y_real']\n",
8990
"y_pred = df['y_pred']\n",
@@ -106,8 +107,8 @@
106107
"outputs": [],
107108
"source": [
108109
"# Read the CSV file which is second setup: added spatial attention\n",
109-
"# df = pd.read_csv('...')\n",
110-
"df = pd.read_csv('...')\n",
110+
"# df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\RUN_D_2023_06_03_T_09_41_Nafiseh.csv')\n",
111+
"df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\onlytest_D_2023_06_06_T_09_44_Nafiseh.csv')\n",
111112
"\n",
112113
"y_true = df['y_real']\n",
113114
"y_pred = df['y_pred']\n",
@@ -130,8 +131,8 @@
130131
"outputs": [],
131132
"source": [
132133
"# Read the CSV file which is 3th setup: LSTM\n",
133-
"# df = pd.read_csv('...')\n",
134-
"df = pd.read_csv('...')\n",
134+
"# df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\RUN_D_2023_06_05_T_16_02_Nafiseh.csv')\n",
135+
"df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\onlytest_D_2023_06_05_T_16_02_Nafiseh.csv')\n",
135136
"\n",
136137
"y_true = df['y_real']\n",
137138
"y_pred = df['y_pred']\n",
@@ -172,8 +173,8 @@
172173
],
173174
"source": [
174175
"# Read the CSV file which is RF\n",
175-
"# df = pd.read_csv('...')\n",
176-
"df = pd.read_csv('...')\n",
176+
"# df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\RUN_D_2023_06_05_T_16_02_Nafiseh.csv')\n",
177+
"df = pd.read_csv('C:\\\\Users\\\\nkakhani\\\\_Multimodal\\\\SoilNet-5\\\\SoilNet\\\\results\\\\RF_D_2023_06_06_T_13_27_Nafiseh.csv')\n",
177178
"\n",
178179
"y_true = df['y_true']\n",
179180
"y_pred = df['y_pred']\n",

MultimodalDL.docx

14.2 KB
Binary file not shown.

README.md

Lines changed: 10 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,5 @@
11
# SoilNet
2-
A Spatio-temporal Framework for Soil Property Prediction with Digital Soil Mapping (DSM)
32

4-
This new architecture, incorporates spatial information using a base convolutional neural network (CNN) model and spatial attention mechanism, along with climate temporal information using a long short-term memory (LSTM) network.
5-
6-
In case you need more information, feel free to send an email: [email protected]
7-
8-
Paper: https://arxiv.org/abs/2308.03586
9-
10-
To access LUCAS topsoil dataset: https://esdac.jrc.ec.europa.eu/content/topsoil-physical-properties-europe-based-lucas-topsoil-data
113

124
<!-- ## Experiments
135
@@ -26,185 +18,29 @@ To access LUCAS topsoil dataset: https://esdac.jrc.ec.europa.eu/content/topsoil-
2618

2719

2820

21+
22+
23+
24+
2925
<!-- ### MODEL
3026
- ~~Add Spatial Attention Module~~
3127
- ~~FCNN + Regressor~~
3228
- ~~FCNN + SA + Regressor~~
3329
- ~~LSTM~~
3430
-->
35-
3631
<!-- ### DATASET
3732
- ~~Add TerraClimate Dataset~~
3833
- ~~Update the ClimateInformation.js (in processing)~~
39-
- ~~Write SRTM + Slope dataset donwlaoder~~
40-
### Analysis
34+
- ~~Write SRTM + Slope dataset donwlaoder~~ -->
35+
36+
### Analysis
4137
- CNN
4238
- CNN + Att
4339
- CNN + Att + LSTM
4440
- RF with no timeseries data
45-
- RF + timeseries data -->
41+
- RF + timeseries data
4642

4743
---
48-
<!-- ![oc_all](https://github.com/moienr/SoilNet/blob/d0255c1ce411e631265daf311f1ca0d68b7b0412/readme_imgs/overallarc2.png) -->
49-
---
50-
![SoilNET](./readme_imgs/overallarc2.png)
44+
<!-- ![oc_germany](https://github.com/moienr/SoilNet/blob/da789f2bf2f2df5dacca6b44ea2be63ed516e54f/dataset/oc_histogram.png) -->
5145
---
52-
53-
<!-- ###
54-
# Usage
55-
56-
57-
## Installation
58-
59-
1. **Prerequisites**:
60-
- Install Conda: Make sure you have Conda installed on your system.
61-
62-
2. **Clone the Repository**:
63-
```bash
64-
git clone https://github.com/moienr/SoilNet.git
65-
```
66-
67-
3. **Create the Environments**:
68-
```bash
69-
cd SoilNet
70-
```
71-
3.1. for training:
72-
```bash
73-
conda env create -f requirements/pytorch_reqs.yml
74-
```
75-
76-
3.2. for dataset:
77-
```bash
78-
conda env create -f requirements/geemap_reqs.yml
79-
```
80-
81-
4. **Activate the Environment**:
82-
83-
4.1. for train:
84-
85-
```bash
86-
conda activate pytorch
87-
```
88-
89-
4.2. to download the dataset:
90-
91-
```bash
92-
conda activate geemap
93-
```
94-
95-
## Training
96-
97-
5. **Run the Code**:
98-
99-
Flags are explained in the next section.
100-
101-
```bash
102-
python train.py -ne 100 -tbs 8 -ne 10 -ca resnet101
103-
```
104-
105-
Although to train, you're gonna need to have the `.csv` files. namely LUCAS dataset under the flag of `--lucas_csv` and the TerraClimate dataset under the flag of `--climate_csv_folder_path`.
106-
107-
The output is a **Training Plot and** a **JSON** file containing all of the results of the **cross-validation**. all will be saved in the `results/` folder
108-
109-
-->
110-
111-
112-
113-
114-
<!--
115-
## Explanation of Command-line Flags for `train.py`
116-
117-
The `train.py` script accepts several command-line flags (arguments) that allow you to customize the training process. These flags help adjust various settings and parameters for the model training. Below is a detailed explanation of each flag:
118-
119-
1. `-nw` or `--num_workers`:
120-
- Type: Integer
121-
- Default: 2
122-
- Description: Number of workers used for data loading during training. Adjust this value based on your system's capabilities to optimize data loading efficiency.
123-
124-
2. `-tbs` or `--train_batch_size`:
125-
- Type: Integer
126-
- Default: 4
127-
- Description: Batch size used during training. A larger batch size can increase training speed but may require more memory.
128-
129-
3. `-Tbs` or `--test_batch_size`:
130-
- Type: Integer
131-
- Default: 4
132-
- Description: Batch size used during testing. Similar to the training batch size, it affects memory consumption during testing.
133-
134-
4. `-lr` or `--learning_rate`:
135-
- Type: Float
136-
- Default: 0.0001
137-
- Description: Learning rate used for the optimization algorithm during training.
138-
139-
5. `-ne` or `--num_epochs`:
140-
- Type: Integer
141-
- Default: 2
142-
- Description: Number of training epochs. An epoch is a complete pass through the entire training dataset.
143-
144-
6. `-lrs` or `--lr_scheduler`:
145-
- Choices: 'step', 'plateau', or None (case-sensitive)
146-
- Default: 'step'
147-
- Description: Learning rate scheduler type. Choose from 'step' (step-wise decay), 'plateau' (decay on validation loss plateau), or None (no learning rate decay).
148-
149-
7. `-oc` or `--oc_max`:
150-
- Type: Integer
151-
- Default: 87
152-
- Description: Maximum value for OC during training. Adjust this value based on your specific use case.
153-
154-
8. `-us` or `--use_srtm`:
155-
- Action: Store True
156-
- Default: True
157-
- Description: Enable or disable the use of SRTM (Shuttle Radar Topography Mission) data during training.
158-
159-
9. `-usa` or `--use_spatial_attention`:
160-
- Action: Store True
161-
- Default: True
162-
- Description: Enable or disable the use of spatial attention in the model architecture.
163-
164-
10. `-ca` or `--cnn_architecture`:
165-
- Choices: 'vgg16', 'resnet101' (case-sensitive)
166-
- Default: 'vgg16'
167-
- Description: Choose the CNN architecture for the model. Options are 'vgg16' or 'resnet101'.
168-
169-
11. `-rv` or `--reg_version`:
170-
- Type: Integer
171-
- Default: 2
172-
- Description: Regression version used during training. Adjust this value based on your specific use case.
173-
174-
12. `-ulb` or `--use_lstm_branch`:
175-
- Action: Store True
176-
- Default: True
177-
- Description: Enable or disable the use of the LSTM branch in the model architecture.
178-
179-
13. `-tl8` or `--train_l8_folder_path`:
180-
- Type: String
181-
- Default: 'D:\python\SoilNet\dataset\l8_images\\train\\'
182-
- Description: Path to the training L8 (Landsat 8) image folder.
183-
184-
14. `-tsl8` or `--test_l8_folder_path`:
185-
- Type: String
186-
- Default: 'D:\python\SoilNet\dataset\l8_images\\test\\'
187-
- Description: Path to the test L8 (Landsat 8) image folder.
188-
189-
15. `-vl8` or `--val_l8_folder_path`:
190-
- Type: String
191-
- Default: 'D:\python\SoilNet\dataset\l8_images\\val\\'
192-
- Description: Path to the validation L8 (Landsat 8) image folder.
193-
194-
16. `-tvsl8` or `--testval_l8_folder_path`:
195-
- Type: String
196-
- Default: 'D:\python\SoilNet\dataset\l8_images\\val\\'
197-
- Description: Path to the test/validation L8 (Landsat 8) image folder.
198-
199-
17. `-lcp` or `--lucas_csv_path`:
200-
- Type: String
201-
- Default: 'D:\python\SoilNet\dataset\LUCAS_2015_all.csv'
202-
- Description: Path to the LUCAS CSV file.
203-
204-
18. `-ccp` or `--climate_csv_folder_path`:
205-
- Type: String
206-
- Default: "D:\\python\\SoilNet\\dataset\\Climate\\All\\filled\\"
207-
- Description: Path to the climate CSV folder.
208-
209-
These command-line flags allow you to configure various aspects of the model training process based on your specific requirements and dataset. Adjust the values according to your needs when running the `train.py` script.
210-
-->
46+
![oc_all](https://github.com/moienr/SoilNet/blob/d0255c1ce411e631265daf311f1ca0d68b7b0412/readme_imgs/oc_all.png)

dataset/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
**/*.tif

dataset/40463116_150107.tif

370 KB
Binary file not shown.

dataset/Climate/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
11
*.csv
2+
RaCA/*
3+
RaCA_SimCLR_all/*
4+
RaCA_SimCLR/*

0 commit comments

Comments
 (0)