Upload 2 files
Browse files- README.md +274 -18
- requirements.txt +28 -6
README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
| 1 |
-
# VIs_to_LAI: Simulate
|
| 2 |
|
| 3 |
**Authors**: Jonghan Ko at Chonnam National University and Chi Tim Ng at Hang Seng University of Hong Kong
|
| 4 |
|
| 5 |
**Collaborator**: Jong-oh Ban at Hallym Polytechnic University
|
| 6 |
|
| 7 |
-
**
|
| 8 |
|
| 9 |
-
**
|
| 10 |
|
| 11 |
---
|
| 12 |
|
|
@@ -18,27 +18,283 @@ VIsToLAI is a Python-based, open-source software framework designed to estimate
|
|
| 18 |
|
| 19 |
## Features
|
| 20 |
|
| 21 |
-
-
|
| 22 |
-
- Three
|
| 23 |
-
-
|
| 24 |
-
-
|
| 25 |
-
-
|
| 26 |
-
-
|
| 27 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
---
|
| 30 |
|
| 31 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
-
|
| 34 |
-
- numpy
|
| 35 |
-
- pandas
|
| 36 |
-
- matplotlib
|
| 37 |
-
- scikit-learn
|
| 38 |
-
- scipy
|
| 39 |
|
| 40 |
-
Install
|
| 41 |
|
| 42 |
```bash
|
| 43 |
pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
|
|
|
|
|
| 1 |
+
# VIs_to_LAI: Simulate Leaf Area Index from Vegetation Indices
|
| 2 |
|
| 3 |
**Authors**: Jonghan Ko at Chonnam National University and Chi Tim Ng at Hang Seng University of Hong Kong
|
| 4 |
|
| 5 |
**Collaborator**: Jong-oh Ban at Hallym Polytechnic University
|
| 6 |
|
| 7 |
+
**GitHub Repository**: [https://github.com/RS-iCM/VIs_to_LAI](https://github.com/RS-iCM/VIs_to_LAI)
|
| 8 |
|
| 9 |
+
**HuggingFace Dataset**: [https://huggingface.co/datasets/jonghanko/VIs_to_LAI/tree/main](https://huggingface.co/datasets/jonghanko/VIs_to_LAI/tree/main)
|
| 10 |
|
| 11 |
---
|
| 12 |
|
|
|
|
| 18 |
|
| 19 |
## Features
|
| 20 |
|
| 21 |
+
- **Multiple Vegetation Indices**: Support for NDVI, RDVI, OSAVI, and MTVI₁
|
| 22 |
+
- **Three Modeling Approaches**:
|
| 23 |
+
- Empirical exponential regression
|
| 24 |
+
- Log–log regression
|
| 25 |
+
- Machine learning (Extra Trees, Gradient Boosting, DNN)
|
| 26 |
+
- **Flexible Workflows**:
|
| 27 |
+
- 1D time-series simulation for point/field data
|
| 28 |
+
- 2D geospatial simulation for regional mapping
|
| 29 |
+
- **Pretrained Models**: Ready-to-use models for rice, barley, wheat, and maize
|
| 30 |
+
- **Interactive Notebooks**: Jupyter notebooks for reproducible workflows
|
| 31 |
+
- **Extensible API**: Modular design for custom indices and algorithms
|
| 32 |
+
- **Built-in Visualization**: Time-series plots, scatter diagnostics, and geospatial maps
|
| 33 |
+
- **Ensemble Methods**: Combine multiple models for improved accuracy
|
| 34 |
|
| 35 |
---
|
| 36 |
|
| 37 |
+
## Installation
|
| 38 |
+
|
| 39 |
+
### Prerequisites
|
| 40 |
+
|
| 41 |
+
- Python ≥ 3.8 (recommended: Python 3.10+)
|
| 42 |
+
- pip package manager
|
| 43 |
|
| 44 |
+
### Quick Install
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
+
Install the package with all dependencies:
|
| 47 |
|
| 48 |
```bash
|
| 49 |
pip install -r requirements.txt
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Or install as an editable package:
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
pip install -e .
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
### Full Installation (with 2D/spatial features and Jupyter)
|
| 59 |
+
|
| 60 |
+
For 2D mapping and geospatial analysis:
|
| 61 |
+
|
| 62 |
+
```bash
|
| 63 |
+
pip install -e ".[all]"
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
This includes:
|
| 67 |
+
- Core dependencies
|
| 68 |
+
- Cartopy (for 2D mapping and shapefile support)
|
| 69 |
+
- tqdm (progress bars)
|
| 70 |
+
- Jupyter notebooks
|
| 71 |
+
|
| 72 |
+
### Optional Extras
|
| 73 |
+
|
| 74 |
+
```bash
|
| 75 |
+
# For 2D/spatial analysis only
|
| 76 |
+
pip install -e ".[2d]"
|
| 77 |
+
|
| 78 |
+
# For Jupyter development only
|
| 79 |
+
pip install -e ".[dev]"
|
| 80 |
+
```
|
| 81 |
+
|
| 82 |
+
### Docker Installation
|
| 83 |
+
|
| 84 |
+
Build and run with Docker:
|
| 85 |
+
|
| 86 |
+
```bash
|
| 87 |
+
# Build the image
|
| 88 |
+
docker build -t vis-to-lai-crops .
|
| 89 |
+
|
| 90 |
+
# Run with Docker Compose (recommended)
|
| 91 |
+
docker-compose up --build
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
Access Jupyter Lab at `http://localhost:8888` (check container logs for token).
|
| 95 |
+
|
| 96 |
+
---
|
| 97 |
+
|
| 98 |
+
## Quick Start
|
| 99 |
+
|
| 100 |
+
### 1D Time-Series Simulation
|
| 101 |
+
|
| 102 |
+
Run a notebook for 1D LAI simulation:
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
jupyter notebook RUN_Python_Rice.ipynb
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
Or use Python directly:
|
| 109 |
+
|
| 110 |
+
```python
|
| 111 |
+
from codes.sim_VIs_to_LAI_crops import main
|
| 112 |
+
import os
|
| 113 |
+
|
| 114 |
+
# Set paths
|
| 115 |
+
path = os.path.abspath(os.getcwd())
|
| 116 |
+
para_FN = path + '/data/empirical_reg_parameters_rice.txt'
|
| 117 |
+
wobs_FN2 = path + '/data/Rice_LAI_n_VIs.csv'
|
| 118 |
+
data_FN = path + '/data/Rice_FN_NICS_2021.csv'
|
| 119 |
+
output_FN = path + '/outputs/SLAI_rice.out'
|
| 120 |
+
|
| 121 |
+
# Model files
|
| 122 |
+
DNN_FN = path + '/models/rice_NN.h5'
|
| 123 |
+
pkl_FN = path + '/models/pickle_extra_trees_Rice.pkl'
|
| 124 |
+
pkl_seq_FN = path + '/models/pickle_extra_trees_Rice_seq.pkl'
|
| 125 |
+
|
| 126 |
+
# Run simulation
|
| 127 |
+
# reg_opt: 0=DNN, 1=ML, 3=NDVI-based, 4=four VIs-based, 5=log-log, 7=Ensemble
|
| 128 |
+
main(DNN_FN, pkl_FN, pkl_seq_FN,
|
| 129 |
+
reg_opt=7, # Ensemble method
|
| 130 |
+
plot_opt=1, # Show plot
|
| 131 |
+
file_opt=1, # Save output
|
| 132 |
+
flag=5.5, # Max LAI value
|
| 133 |
+
para_FN=para_FN,
|
| 134 |
+
wobs_FN2=wobs_FN2,
|
| 135 |
+
data_FN=data_FN,
|
| 136 |
+
output_FN=output_FN)
|
| 137 |
+
```
|
| 138 |
+
|
| 139 |
+
### 2D Geospatial Simulation
|
| 140 |
+
|
| 141 |
+
For 2D regional mapping:
|
| 142 |
+
|
| 143 |
+
```bash
|
| 144 |
+
jupyter notebook RUN_Python_LAI_2D_Rice.ipynb
|
| 145 |
+
```
|
| 146 |
+
|
| 147 |
+
---
|
| 148 |
+
|
| 149 |
+
## Available Notebooks
|
| 150 |
+
|
| 151 |
+
### 1D Time-Series Notebooks
|
| 152 |
+
- `RUN_Python_Rice.ipynb` - Rice LAI simulation
|
| 153 |
+
- `RUN_Python_Barley.ipynb` - Barley LAI simulation
|
| 154 |
+
- `RUN_Python_Wheat.ipynb` - Wheat LAI simulation
|
| 155 |
+
- `RUN_Python_Maize.ipynb` - Maize LAI simulation
|
| 156 |
+
|
| 157 |
+
### 2D Geospatial Notebooks
|
| 158 |
+
- `RUN_Python_LAI_2D_Rice.ipynb` - Regional rice LAI mapping
|
| 159 |
+
- `RUN_Python_LAI_2D_Maize.ipynb` - Regional maize LAI mapping
|
| 160 |
+
|
| 161 |
+
---
|
| 162 |
+
|
| 163 |
+
## Model Options
|
| 164 |
+
|
| 165 |
+
The framework supports multiple regression options (`reg_opt` parameter):
|
| 166 |
+
|
| 167 |
+
- **0**: Deep Neural Network (DNN)
|
| 168 |
+
- **1**: Machine Learning - Extra Trees Regressor
|
| 169 |
+
- **2**: Machine Learning - Sequential (with temporal features)
|
| 170 |
+
- **3**: NDVI-based empirical regression
|
| 171 |
+
- **4**: Four VIs-based empirical regression (ensemble of all VIs)
|
| 172 |
+
- **5**: Log-log regression
|
| 173 |
+
- **6**: Ensemble 1 (DNN + ML + VIs + Log-log)
|
| 174 |
+
- **7**: Ensemble 2 (ML + VIs + Log-log) - **Recommended**
|
| 175 |
+
|
| 176 |
+
---
|
| 177 |
+
|
| 178 |
+
## Project Structure
|
| 179 |
+
|
| 180 |
+
```
|
| 181 |
+
VIs_to_LAI_crops/
|
| 182 |
+
├── codes/ # Core Python modules
|
| 183 |
+
│ ├── sim_VIs_to_LAI_crops.py # Main 1D simulation module
|
| 184 |
+
│ ├── empirical_VIs_to_LAI_2D_*.py # 2D empirical modules
|
| 185 |
+
│ └── each_crop_model/ # Crop-specific models
|
| 186 |
+
├── data/ # Input data (CSV, OBS, TXT)
|
| 187 |
+
│ ├── *_LAI_n_VIs.csv # Training data
|
| 188 |
+
│ └── empirical_reg_parameters_*.txt # Regression parameters
|
| 189 |
+
├── models/ # Pretrained models
|
| 190 |
+
│ ├── *_NN.h5 # DNN models
|
| 191 |
+
│ └── pickle_*.pkl # ML models
|
| 192 |
+
├── outputs/ # Simulation outputs
|
| 193 |
+
│ └── SLAI_*.out # Simulated LAI files
|
| 194 |
+
├── class_map_*/ # 2D class maps
|
| 195 |
+
├── vis_*/ # 2D vegetation indices
|
| 196 |
+
├── Shape_*/ # Shapefile boundaries (2D)
|
| 197 |
+
├── RUN_Python_*.ipynb # Jupyter notebooks
|
| 198 |
+
├── setup.py # Package setup
|
| 199 |
+
├── requirements.txt # Python dependencies
|
| 200 |
+
└── Dockerfile # Docker configuration
|
| 201 |
+
```
|
| 202 |
+
|
| 203 |
+
---
|
| 204 |
+
|
| 205 |
+
## Requirements
|
| 206 |
+
|
| 207 |
+
### Core Dependencies
|
| 208 |
+
- numpy ≥ 1.20.0
|
| 209 |
+
- pandas ≥ 1.3.0
|
| 210 |
+
- scipy ≥ 1.7.0
|
| 211 |
+
- scikit-learn ≥ 1.0.0
|
| 212 |
+
- matplotlib ≥ 3.4.0
|
| 213 |
+
- tensorflow ≥ 2.8.0
|
| 214 |
+
- keras ≥ 2.8.0
|
| 215 |
+
- h5py ≥ 3.0.0
|
| 216 |
+
- pyyaml ≥ 5.4.0
|
| 217 |
+
|
| 218 |
+
### Optional Dependencies (for 2D features)
|
| 219 |
+
- cartopy ≥ 0.20.0 (geospatial mapping)
|
| 220 |
+
- tqdm ≥ 4.64.0 (progress bars)
|
| 221 |
+
|
| 222 |
+
### Development Dependencies
|
| 223 |
+
- jupyter ≥ 1.0.0
|
| 224 |
+
- ipykernel ≥ 6.0.0
|
| 225 |
+
- notebook ≥ 6.4.0
|
| 226 |
+
|
| 227 |
+
See `requirements.txt` for a complete list.
|
| 228 |
+
|
| 229 |
+
---
|
| 230 |
+
|
| 231 |
+
## Usage Examples
|
| 232 |
+
|
| 233 |
+
### Example 1: Rice LAI Simulation with Ensemble Method
|
| 234 |
+
|
| 235 |
+
```python
|
| 236 |
+
from codes.sim_VIs_to_LAI_crops import main
|
| 237 |
+
import os
|
| 238 |
+
|
| 239 |
+
path = os.path.abspath(os.getcwd())
|
| 240 |
+
main(
|
| 241 |
+
DNN_FN=path + '/models/rice_NN.h5',
|
| 242 |
+
pkl_FN=path + '/models/pickle_extra_trees_Rice.pkl',
|
| 243 |
+
pkl_seq_FN=path + '/models/pickle_extra_trees_Rice_seq.pkl',
|
| 244 |
+
reg_opt=7, # Ensemble method
|
| 245 |
+
plot_opt=1,
|
| 246 |
+
file_opt=1,
|
| 247 |
+
flag=5.5,
|
| 248 |
+
para_FN=path + '/data/empirical_reg_parameters_rice.txt',
|
| 249 |
+
wobs_FN2=path + '/data/Rice_LAI_n_VIs.csv',
|
| 250 |
+
data_FN=path + '/data/Rice_FN_NICS_2021.csv',
|
| 251 |
+
output_FN=path + '/outputs/SLAI_rice.out'
|
| 252 |
+
)
|
| 253 |
+
```
|
| 254 |
+
|
| 255 |
+
---
|
| 256 |
+
|
| 257 |
+
## Citation
|
| 258 |
+
|
| 259 |
+
If you use this software in your research, please cite:
|
| 260 |
+
|
| 261 |
+
```bibtex
|
| 262 |
+
@software{vistolai2024,
|
| 263 |
+
author = {Ko, Jonghan and Ng, Chi Tim},
|
| 264 |
+
title = {VIs_to_LAI: Simulate Leaf Area Index from Vegetation Indices},
|
| 265 |
+
year = {2024},
|
| 266 |
+
url = {https://github.com/RS-iCM/VIs_to_LAI}
|
| 267 |
+
}
|
| 268 |
+
```
|
| 269 |
+
|
| 270 |
+
---
|
| 271 |
+
|
| 272 |
+
## License
|
| 273 |
+
|
| 274 |
+
[Specify your license here - e.g., MIT, Apache 2.0, etc.]
|
| 275 |
+
|
| 276 |
+
---
|
| 277 |
+
|
| 278 |
+
## Contributing
|
| 279 |
+
|
| 280 |
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
| 281 |
+
|
| 282 |
+
---
|
| 283 |
+
|
| 284 |
+
## Support
|
| 285 |
+
|
| 286 |
+
For questions, issues, or contributions, please visit:
|
| 287 |
+
- **GitHub Issues**: [https://github.com/RS-iCM/VIs_to_LAI/issues](https://github.com/RS-iCM/VIs_to_LAI/issues)
|
| 288 |
+
- **HuggingFace**: [https://huggingface.co/datasets/jonghanko/VIs_to_LAI](https://huggingface.co/datasets/jonghanko/VIs_to_LAI)
|
| 289 |
+
|
| 290 |
+
---
|
| 291 |
+
|
| 292 |
+
## Acknowledgments
|
| 293 |
+
|
| 294 |
+
- Chonnam National University
|
| 295 |
+
- Hang Seng University of Hong Kong
|
| 296 |
+
- Hallym Polytechnic University
|
| 297 |
+
|
| 298 |
+
---
|
| 299 |
|
| 300 |
+
**Last Updated**: August 2025
|
requirements.txt
CHANGED
|
@@ -1,6 +1,28 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Core dependencies for VIs_to_LAI_crops
|
| 2 |
+
# These are the minimum required packages for basic functionality
|
| 3 |
+
|
| 4 |
+
# Scientific computing and data manipulation
|
| 5 |
+
numpy>=1.20.0
|
| 6 |
+
pandas>=1.3.0
|
| 7 |
+
scipy>=1.7.0
|
| 8 |
+
|
| 9 |
+
# Machine learning
|
| 10 |
+
scikit-learn>=1.0.0
|
| 11 |
+
tensorflow>=2.8.0
|
| 12 |
+
keras>=2.8.0
|
| 13 |
+
|
| 14 |
+
# Data I/O and file handling
|
| 15 |
+
h5py>=3.0.0
|
| 16 |
+
pyyaml>=5.4.0
|
| 17 |
+
|
| 18 |
+
# Visualization
|
| 19 |
+
matplotlib>=3.4.0
|
| 20 |
+
|
| 21 |
+
# Optional dependencies for 2D/spatial analysis (uncomment if needed)
|
| 22 |
+
# cartopy>=0.20.0 # Required for 2D mapping and shapefile support
|
| 23 |
+
# tqdm>=4.64.0 # Progress bars for long-running operations
|
| 24 |
+
|
| 25 |
+
# Development dependencies (for Jupyter notebooks)
|
| 26 |
+
# jupyter>=1.0.0
|
| 27 |
+
# ipykernel>=6.0.0
|
| 28 |
+
# notebook>=6.4.0
|