# boudiafa/agriscope architecture

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

- Interactive diagram: https://gitdiagram.com/boudiafa/agriscope
- Repository: https://github.com/boudiafa/agriscope

## Overview

AgriScope is documented as a multimodal agricultural-image understanding model, paired with the AgriGround dataset and its annotation pipeline. The main inference path combines biological and spatial visual features with a prompt, then grounds generated text through mask decoding. The README documents the model architecture and four annotation stages, but the repository tree contains no implementation source; these nodes therefore point to the README, and the graph reflects documented design rather than verified runtime calls.

Main entry points: [`README.md`](https://github.com/boudiafa/agriscope/blob/main/README.md) (AgriGround Dataset)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model["AgriScope Model"]
  node_bio["Biological Encoder<br/>[README.md]"]
  node_global["Global Encoder<br/>[README.md]"]
  node_mlm["Multimodal Language Model<br/>[README.md]"]
  node_projection["Grounding Projection<br/>[README.md]"]
  node_sam["SAM2 Mask Decoder<br/>[README.md]"]
  node_outputs["Grounded Outputs<br/>[README.md]"]
end

subgraph group_annotation["Annotation Pipeline"]
  node_stage1["Caption and Metadata<br/>[README.md]"]
  node_stage2["Phrase Grounding Prep<br/>[README.md]"]
  node_stage3["Mask Alignment<br/>[README.md]"]
  node_stage4["Instruction Synthesis<br/>[README.md]"]
end

subgraph group_dataset["Dataset and Tasks"]
  node_agriground[("AgriGround Dataset<br/>[README.md]")]
  node_captioning["Captioning Tasks<br/>[README.md]"]
  node_segmentation["Segmentation Tasks<br/>[README.md]"]
  node_detection["Detection Tasks<br/>[README.md]"]
  node_conversation["Conversation and QA<br/>[README.md]"]
end

node_user(("User"))
node_hf["Hugging Face"]

node_user -->|"provides image and prompt"| node_mlm
node_bio -->|"supplies semantics"| node_mlm
node_global -->|"supplies spatial features"| node_mlm
node_mlm -->|"emits SEG states"| node_projection
node_projection -->|"conditions masks"| node_sam
node_mlm -->|"generates text"| node_outputs
node_sam -->|"produces masks"| node_outputs
node_stage1 -->|"feeds captions"| node_stage2
node_stage2 -->|"prepares prompts"| node_stage3
node_stage3 -->|"supplies aligned masks"| node_stage4
node_stage4 -->|"synthesizes records"| node_agriground
node_agriground -->|"trains model"| node_mlm
node_agriground -->|"covers"| node_captioning
node_agriground -->|"covers"| node_segmentation
node_agriground -->|"covers"| node_detection
node_agriground -->|"covers"| node_conversation
node_agriground -->|"annotations hosted on"| node_hf

click node_bio "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_global "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_mlm "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_projection "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_sam "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_outputs "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_stage1 "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_stage2 "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_stage3 "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_stage4 "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_agriground "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_captioning "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_segmentation "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_detection "https://github.com/boudiafa/agriscope/blob/main/README.md"
click node_conversation "https://github.com/boudiafa/agriscope/blob/main/README.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_bio,node_global,node_mlm,node_projection,node_sam,node_outputs,node_user toneBlue
class node_stage1,node_stage2,node_stage3,node_stage4 toneAmber
class node_agriground,node_captioning,node_segmentation,node_detection,node_conversation toneMint
class node_hf toneIndigo
```

## Components

### AgriScope Model

- [Biological Encoder](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Global Encoder](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Multimodal Language Model](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Grounding Projection](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [SAM2 Mask Decoder](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Grounded Outputs](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`

### Annotation Pipeline

- [Caption and Metadata](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Phrase Grounding Prep](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Mask Alignment](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Instruction Synthesis](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`

### Dataset and Tasks

- [AgriGround Dataset](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Captioning Tasks](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Segmentation Tasks](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Detection Tasks](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`
- [Conversation and QA](https://github.com/boudiafa/agriscope/blob/main/README.md): `README.md`

### Other components

- **User**
- **Hugging Face**

## Connections

- User → Multimodal Language Model: provides image and prompt (evidence: `README.md`)
- Biological Encoder → Multimodal Language Model: supplies semantics (evidence: `README.md`)
- Global Encoder → Multimodal Language Model: supplies spatial features (evidence: `README.md`)
- Multimodal Language Model → Grounding Projection: emits SEG states (evidence: `README.md`)
- Grounding Projection → SAM2 Mask Decoder: conditions masks (evidence: `README.md`)
- Multimodal Language Model → Grounded Outputs: generates text (evidence: `README.md`)
- SAM2 Mask Decoder → Grounded Outputs: produces masks (evidence: `README.md`)
- Caption and Metadata → Phrase Grounding Prep: feeds captions (evidence: `README.md`)
- Phrase Grounding Prep → Mask Alignment: prepares prompts (evidence: `README.md`)
- Mask Alignment → Instruction Synthesis: supplies aligned masks (evidence: `README.md`)
- Instruction Synthesis → AgriGround Dataset: synthesizes records (evidence: `README.md`)
- AgriGround Dataset → Multimodal Language Model: trains model (evidence: `README.md`)
- AgriGround Dataset → Captioning Tasks: covers (evidence: `README.md`)
- AgriGround Dataset → Segmentation Tasks: covers (evidence: `README.md`)
- AgriGround Dataset → Detection Tasks: covers (evidence: `README.md`)
- AgriGround Dataset → Conversation and QA: covers (evidence: `README.md`)
- AgriGround Dataset → Hugging Face: annotations hosted on (evidence: `README.md`)
