# revanth2716/fieldlens-ai architecture

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

- Interactive diagram: https://gitdiagram.com/revanth2716/fieldlens-ai
- Repository: https://github.com/revanth2716/fieldlens-ai

## Overview

FieldLens is a plant-leaf classifier whose main workflow prepares dataset metadata, audits leaf-identity splits, acquires images, trains a model, and evaluates its accuracy and confidence reliability. Users can also predict or explain a single image and use a Streamlit interface. The graph includes the documented data-preparation stages even though their implementation files are absent from the supplied tree; those are represented at the enclosing source directory. Some UI and inference internals were not sampled, so their detailed interactions are omitted.

Main entry points: [`src/fieldlens/cli.py`](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/cli.py) (CLI commands), [`src/fieldlens/eval/run.py`](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/run.py) (Evaluation pipeline), [`src/fieldlens/training/train.py`](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/training/train.py) (Staged training), [`src/fieldlens/inference/predictor.py`](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/inference/predictor.py) (Image prediction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Data workflow"]
  node_cli["CLI commands<br/>[cli.py]"]
  node_metadata["Metadata preparation"]
  node_split["Split audit"]
  node_acquire["Image acquisition"]
end

subgraph group_modeling["Model lifecycle"]
  node_dataset["Manifest dataset<br/>[dataset.py]"]
  node_config["Validated config<br/>[config.py]"]
  node_factory["Model factory<br/>[factory.py]"]
  node_training["Staged training<br/>[train.py]"]
  node_checkpoint[("Checkpoint store<br/>[checkpoint.py]")]
end

subgraph group_assurance["Confidence assurance"]
  node_evaluation["Evaluation pipeline<br/>[run.py]"]
  node_metrics["Classification metrics<br/>[metrics.py]"]
  node_calibration["Temperature calibration<br/>[calibration.py]"]
  node_robustness["Robustness sweeps<br/>[robustness.py]"]
  node_reports["Evaluation reports"]
end

subgraph group_serving["Prediction and interface"]
  node_predictor["Image prediction<br/>[predictor.py]"]
  node_explain["Grad-CAM explanation<br/>[gradcam.py]"]
  node_ui["Streamlit interface<br/>[app.py]"]
end

node_user(("User"))

node_user -->|"runs commands"| node_cli
node_cli -->|"prepares metadata"| node_metadata
node_cli -->|"builds and audits"| node_split
node_cli -->|"acquires images"| node_acquire
node_cli -->|"starts training"| node_training
node_cli -->|"starts evaluation"| node_evaluation
node_cli -->|"requests prediction"| node_predictor
node_cli -->|"requests explanation"| node_explain
node_cli -->|"launches interface"| node_ui
node_training -->|"loads settings"| node_config
node_training -->|"loads manifest images"| node_dataset
node_training -->|"builds model"| node_factory
node_training -->|"evaluates validation"| node_metrics
node_training -->|"saves checkpoint"| node_checkpoint
node_evaluation -->|"loads settings"| node_config
node_evaluation -->|"collects image logits"| node_dataset
node_evaluation -->|"loads checkpoint"| node_checkpoint
node_evaluation -->|"fits temperature"| node_calibration
node_evaluation -->|"computes scores"| node_metrics
node_evaluation -->|"runs sweeps"| node_robustness
node_evaluation -->|"writes reports"| node_reports
node_predictor -.->|"loads model state"| node_checkpoint
node_explain -->|"uses predictor model"| node_predictor
node_ui -->|"presents predictions"| node_predictor
node_ui -->|"offers Grad-CAM"| node_explain

click node_cli "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/cli.py"
click node_metadata "https://github.com/revanth2716/fieldlens-ai/tree/master/src/fieldlens"
click node_split "https://github.com/revanth2716/fieldlens-ai/tree/master/src/fieldlens"
click node_acquire "https://github.com/revanth2716/fieldlens-ai/tree/master/src/fieldlens"
click node_dataset "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/training/dataset.py"
click node_config "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/config.py"
click node_factory "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/models/factory.py"
click node_training "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/training/train.py"
click node_checkpoint "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/models/checkpoint.py"
click node_evaluation "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/run.py"
click node_metrics "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/metrics.py"
click node_calibration "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/calibration.py"
click node_robustness "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/robustness.py"
click node_reports "https://github.com/revanth2716/fieldlens-ai/tree/master/artifacts/reports"
click node_predictor "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/inference/predictor.py"
click node_explain "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/explain/gradcam.py"
click node_ui "https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/ui/app.py"

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_cli,node_metadata,node_split,node_acquire,node_user toneBlue
class node_dataset,node_config,node_factory,node_training,node_checkpoint toneAmber
class node_evaluation,node_metrics,node_calibration,node_robustness,node_reports toneMint
class node_predictor,node_explain,node_ui toneRose
```

## Components

### Data workflow

- [CLI commands](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/cli.py): `src/fieldlens/cli.py`
- [Metadata preparation](https://github.com/revanth2716/fieldlens-ai/tree/master/src/fieldlens): `src/fieldlens`
- [Split audit](https://github.com/revanth2716/fieldlens-ai/tree/master/src/fieldlens): `src/fieldlens`
- [Image acquisition](https://github.com/revanth2716/fieldlens-ai/tree/master/src/fieldlens): `src/fieldlens`

### Model lifecycle

- [Manifest dataset](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/training/dataset.py): `src/fieldlens/training/dataset.py`
- [Validated config](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/config.py): `src/fieldlens/config.py`
- [Model factory](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/models/factory.py): `src/fieldlens/models/factory.py`
- [Staged training](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/training/train.py): `src/fieldlens/training/train.py`
- [Checkpoint store](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/models/checkpoint.py): `src/fieldlens/models/checkpoint.py`

### Confidence assurance

- [Evaluation pipeline](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/run.py): `src/fieldlens/eval/run.py`
- [Classification metrics](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/metrics.py): `src/fieldlens/eval/metrics.py`
- [Temperature calibration](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/calibration.py): `src/fieldlens/eval/calibration.py`
- [Robustness sweeps](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/eval/robustness.py): `src/fieldlens/eval/robustness.py`
- [Evaluation reports](https://github.com/revanth2716/fieldlens-ai/tree/master/artifacts/reports): `artifacts/reports`

### Prediction and interface

- [Image prediction](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/inference/predictor.py): `src/fieldlens/inference/predictor.py`
- [Grad-CAM explanation](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/explain/gradcam.py): `src/fieldlens/explain/gradcam.py`
- [Streamlit interface](https://github.com/revanth2716/fieldlens-ai/blob/master/src/fieldlens/ui/app.py): `src/fieldlens/ui/app.py`

### Other components

- **User**

## Connections

- User → CLI commands: runs commands (evidence: `README.md`)
- CLI commands → Metadata preparation: prepares metadata (evidence: `README.md`)
- CLI commands → Split audit: builds and audits (evidence: `README.md`)
- CLI commands → Image acquisition: acquires images (evidence: `README.md`)
- CLI commands → Staged training: starts training (evidence: `src/fieldlens/cli.py`)
- CLI commands → Evaluation pipeline: starts evaluation (evidence: `src/fieldlens/cli.py`)
- CLI commands → Image prediction: requests prediction (evidence: `src/fieldlens/cli.py`)
- CLI commands → Grad-CAM explanation: requests explanation (evidence: `src/fieldlens/cli.py`)
- CLI commands → Streamlit interface: launches interface (evidence: `README.md`)
- Staged training → Validated config: loads settings (evidence: `src/fieldlens/training/train.py`)
- Staged training → Manifest dataset: loads manifest images (evidence: `src/fieldlens/training/train.py`)
- Staged training → Model factory: builds model (evidence: `src/fieldlens/training/train.py`)
- Staged training → Classification metrics: evaluates validation (evidence: `src/fieldlens/training/train.py`)
- Staged training → Checkpoint store: saves checkpoint (evidence: `src/fieldlens/training/train.py`)
- Evaluation pipeline → Validated config: loads settings (evidence: `src/fieldlens/eval/run.py`)
- Evaluation pipeline → Manifest dataset: collects image logits (evidence: `src/fieldlens/eval/run.py`)
- Evaluation pipeline → Checkpoint store: loads checkpoint (evidence: `src/fieldlens/eval/run.py`)
- Evaluation pipeline → Temperature calibration: fits temperature (evidence: `src/fieldlens/eval/run.py`)
- Evaluation pipeline → Classification metrics: computes scores (evidence: `src/fieldlens/eval/run.py`)
- Evaluation pipeline → Robustness sweeps: runs sweeps (evidence: `README.md`)
- Evaluation pipeline → Evaluation reports: writes reports (evidence: `README.md`)
- Image prediction → Checkpoint store: loads model state
- Grad-CAM explanation → Image prediction: uses predictor model (evidence: `src/fieldlens/explain/gradcam.py`)
- Streamlit interface → Image prediction: presents predictions (evidence: `README.md`)
- Streamlit interface → Grad-CAM explanation: offers Grad-CAM (evidence: `README.md`)
