# niharxd/pixels-to-water architecture

> Architecture diagram of the GitHub repository niharxd/pixels-to-water, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/niharxd/pixels-to-water
- Repository: https://github.com/niharxd/pixels-to-water

## Overview

Pixels to Water is a research repository with two separate workstreams: sorghum cultivar classification and lettuce LAI estimation with irrigation-demand decision support. The principal user-facing workflow is the lettuce prototype: select an image, provide date and environment, estimate LAI, combine it with reference ET₀ and rainfall, and display a relative demand class. Sorghum has a separate data-to-model experiment workflow. The README documents major capabilities that are not represented by sampled implementation excerpts; those links are cited to the README, not treated as inspected source behavior.

Main entry points: [`workspace/DatasetLAI/Decision_Engine.ipynb`](https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/Decision_Engine.ipynb) (Desktop prototype), [`docs/irrigation_decision_engine.md`](https://github.com/niharxd/pixels-to-water/blob/main/docs/irrigation_decision_engine.md) (Demand fusion), [`src/train_resnet.py`](https://github.com/niharxd/pixels-to-water/blob/main/src/train_resnet.py) (Sorghum training), [`workspace/DatasetLAI/lai_rf_model.joblib`](https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/lai_rf_model.joblib) (LAI Random Forest)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sorghum_data["Sorghum data"]
  node_field_images[("Field images")]
  node_balanced_subset["Balanced subset"]
  node_split_manifests["Split manifests"]
  node_image_dataset["Image dataset<br/>[dataset.py]"]
  node_image_preprocessing["Image transforms<br/>[preprocessing.py]"]
end

subgraph group_sorghum_models["Sorghum modeling"]
  node_sorghum_training["Sorghum training<br/>[train_resnet.py]"]
  node_classification_models["Classifier comparison"]
  node_classification_evaluation["Classification evaluation"]
end

subgraph group_lettuce_estimation["Lettuce estimation"]
  node_lai_images[("Lettuce images")]
  node_lai_features["RGB features"]
  node_lai_random_forest["LAI Random Forest"]
  node_lai_regression["CNN regression"]
  node_lai_comparison["LAI comparison"]
end

subgraph group_irrigation_decision["Irrigation decision"]
  node_desktop_prototype["Desktop prototype"]
  node_lai_rules["LAI demand rules<br/>[22_engine.ipynb]"]
  node_weather_reference[("Reference weather<br/>[Weather_ET0.ipynb]")]
  node_demand_fusion["Demand fusion"]
  node_demand_result["Demand summary"]
end

node_researcher(("Researcher"))
node_prototype_user(("Prototype user"))

node_field_images -->|"samples images"| node_balanced_subset
node_balanced_subset -->|"splits manifest"| node_split_manifests
node_split_manifests -->|"loads samples"| node_image_dataset
node_image_dataset -->|"provides batches"| node_sorghum_training
node_image_preprocessing -->|"transforms images"| node_sorghum_training
node_sorghum_training -->|"trains classifiers"| node_classification_models
node_classification_models -->|"compares results"| node_classification_evaluation
node_lai_images -->|"extracts features"| node_lai_features
node_lai_features -->|"predicts LAI"| node_lai_random_forest
node_lai_images -->|"regresses LAI"| node_lai_regression
node_lai_random_forest -->|"compared with CNNs"| node_lai_comparison
node_lai_regression -->|"compared with baseline"| node_lai_comparison
node_prototype_user -->|"enters inputs"| node_desktop_prototype
node_desktop_prototype -->|"estimates LAI"| node_lai_random_forest
node_desktop_prototype -->|"looks up weather"| node_weather_reference
node_weather_reference -->|"supplies ET₀ and rain"| node_demand_fusion
node_lai_rules -->|"classifies LAI"| node_demand_fusion
node_desktop_prototype -->|"combines demand levels"| node_demand_fusion
node_demand_fusion -->|"reports demand class"| node_demand_result
node_demand_result -->|"displays summary"| node_prototype_user

click node_balanced_subset "https://github.com/niharxd/pixels-to-water/blob/main/src/create_balanced_subset.py"
click node_split_manifests "https://github.com/niharxd/pixels-to-water/blob/main/src/create_dataset_split.py"
click node_image_dataset "https://github.com/niharxd/pixels-to-water/blob/main/src/dataset.py"
click node_image_preprocessing "https://github.com/niharxd/pixels-to-water/blob/main/src/preprocessing.py"
click node_sorghum_training "https://github.com/niharxd/pixels-to-water/blob/main/src/train_resnet.py"
click node_classification_models "https://github.com/niharxd/pixels-to-water/blob/main/notebooks/07_efficientnet_b0_implementation.ipynb"
click node_classification_evaluation "https://github.com/niharxd/pixels-to-water/blob/main/notebooks/06_resnet18_evaluation.ipynb"
click node_lai_features "https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/Decision_Engine.ipynb"
click node_lai_random_forest "https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/lai_rf_model.joblib"
click node_lai_regression "https://github.com/niharxd/pixels-to-water/blob/main/notebooks/18_lai_resnet18_clean_split.ipynb"
click node_lai_comparison "https://github.com/niharxd/pixels-to-water/blob/main/notebooks/20_lai_model_comparison.ipynb"
click node_desktop_prototype "https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/Decision_Engine.ipynb"
click node_lai_rules "https://github.com/niharxd/pixels-to-water/blob/main/notebooks/22_engine.ipynb"
click node_weather_reference "https://github.com/niharxd/pixels-to-water/blob/main/notebooks/Weather_ET0.ipynb"
click node_demand_fusion "https://github.com/niharxd/pixels-to-water/blob/main/docs/irrigation_decision_engine.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_field_images,node_balanced_subset,node_split_manifests,node_image_dataset,node_image_preprocessing,node_prototype_user toneBlue
class node_sorghum_training,node_classification_models,node_classification_evaluation toneAmber
class node_lai_images,node_lai_features,node_lai_random_forest,node_lai_regression,node_lai_comparison toneMint
class node_desktop_prototype,node_lai_rules,node_weather_reference,node_demand_fusion,node_demand_result toneRose
class node_researcher toneIndigo
```

## Components

### Sorghum data

- **Field images**
- [Balanced subset](https://github.com/niharxd/pixels-to-water/blob/main/src/create_balanced_subset.py): `src/create_balanced_subset.py`
- [Split manifests](https://github.com/niharxd/pixels-to-water/blob/main/src/create_dataset_split.py): `src/create_dataset_split.py`
- [Image dataset](https://github.com/niharxd/pixels-to-water/blob/main/src/dataset.py): `src/dataset.py`
- [Image transforms](https://github.com/niharxd/pixels-to-water/blob/main/src/preprocessing.py): `src/preprocessing.py`

### Sorghum modeling

- [Sorghum training](https://github.com/niharxd/pixels-to-water/blob/main/src/train_resnet.py): `src/train_resnet.py`
- [Classifier comparison](https://github.com/niharxd/pixels-to-water/blob/main/notebooks/07_efficientnet_b0_implementation.ipynb): `notebooks/07_efficientnet_b0_implementation.ipynb`
- [Classification evaluation](https://github.com/niharxd/pixels-to-water/blob/main/notebooks/06_resnet18_evaluation.ipynb): `notebooks/06_resnet18_evaluation.ipynb`

### Lettuce estimation

- **Lettuce images**
- [RGB features](https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/Decision_Engine.ipynb): `workspace/DatasetLAI/Decision_Engine.ipynb`
- [LAI Random Forest](https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/lai_rf_model.joblib): `workspace/DatasetLAI/lai_rf_model.joblib`
- [CNN regression](https://github.com/niharxd/pixels-to-water/blob/main/notebooks/18_lai_resnet18_clean_split.ipynb): `notebooks/18_lai_resnet18_clean_split.ipynb`
- [LAI comparison](https://github.com/niharxd/pixels-to-water/blob/main/notebooks/20_lai_model_comparison.ipynb): `notebooks/20_lai_model_comparison.ipynb`

### Irrigation decision

- [Desktop prototype](https://github.com/niharxd/pixels-to-water/blob/main/workspace/DatasetLAI/Decision_Engine.ipynb): `workspace/DatasetLAI/Decision_Engine.ipynb`
- [LAI demand rules](https://github.com/niharxd/pixels-to-water/blob/main/notebooks/22_engine.ipynb): `notebooks/22_engine.ipynb`
- [Reference weather](https://github.com/niharxd/pixels-to-water/blob/main/notebooks/Weather_ET0.ipynb): `notebooks/Weather_ET0.ipynb`
- [Demand fusion](https://github.com/niharxd/pixels-to-water/blob/main/docs/irrigation_decision_engine.md): `docs/irrigation_decision_engine.md`
- **Demand summary**

### Other components

- **Researcher**
- **Prototype user**

## Connections

- Field images → Balanced subset: samples images (evidence: `src/create_balanced_subset.py`)
- Balanced subset → Split manifests: splits manifest (evidence: `README.md`)
- Split manifests → Image dataset: loads samples
- Image dataset → Sorghum training: provides batches (evidence: `src/train_resnet.py`)
- Image transforms → Sorghum training: transforms images (evidence: `src/train_resnet.py`)
- Sorghum training → Classifier comparison: trains classifiers (evidence: `README.md`)
- Classifier comparison → Classification evaluation: compares results (evidence: `README.md`)
- Lettuce images → RGB features: extracts features (evidence: `README.md`)
- RGB features → LAI Random Forest: predicts LAI (evidence: `README.md`)
- Lettuce images → CNN regression: regresses LAI (evidence: `README.md`)
- LAI Random Forest → LAI comparison: compared with CNNs (evidence: `README.md`)
- CNN regression → LAI comparison: compared with baseline (evidence: `README.md`)
- Prototype user → Desktop prototype: enters inputs (evidence: `README.md`)
- Desktop prototype → LAI Random Forest: estimates LAI (evidence: `README.md`)
- Desktop prototype → Reference weather: looks up weather (evidence: `README.md`)
- Reference weather → Demand fusion: supplies ET₀ and rain (evidence: `README.md`)
- LAI demand rules → Demand fusion: classifies LAI (evidence: `README.md`)
- Desktop prototype → Demand fusion: combines demand levels (evidence: `README.md`)
- Demand fusion → Demand summary: reports demand class (evidence: `README.md`)
- Demand summary → Prototype user: displays summary (evidence: `README.md`)
