# saqibshouqi/gemstone-classification-evolution architecture

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

- Interactive diagram: https://gitdiagram.com/saqibshouqi/gemstone-classification-evolution
- Repository: https://github.com/saqibshouqi/gemstone-classification-evolution

## Overview

This repository is a reproducible gemstone-image classification research project comparing three method generations against a shared 68-class benchmark. The principal workflow is to construct the canonical split, train a method to produce shared-format predictions, validate those predictions, and evaluate them into metrics and reports; a duplicate audit supports de-duplicated scoring. The graph includes the documented G1/G2/G3 branches and the shared protocol and scoreboard. Some method and reporting internals were not sampled, so their documented capabilities are shown without speculative implementation links.

Main entry points: [`src/gemstone_trends/data/splits.py`](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/data/splits.py) (Canonical split), [`src/g2/training.py`](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/training.py) (G2 training), [`results/preds`](https://github.com/saqibshouqi/gemstone-classification-evolution/tree/main/results/preds) (Prediction files), [`src/gemstone_trends/evaluation/report.py`](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/evaluation/report.py) (Scoreboard and reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_protocol["Benchmark protocol"]
  node_split["Canonical split<br/>[splits.py]"]
end

subgraph group_methods["Classification methods"]
  node_g1["G1 methods<br/>[api.py]"]
  node_g2_train["G2 training<br/>[training.py]"]
  node_g2_features["G2 features<br/>[features.py]"]
  node_g2_masks["G2 segmentation<br/>[segmentation.py]"]
  node_g2_models["G2 classifiers<br/>[models.py]"]
  node_g3_train["G3 training<br/>[train.py]"]
  node_g3_models["G3 models<br/>[models.py]"]
  node_g3_cbam["CBAM attention<br/>[cbam.py]"]
  node_g3_resnet["ResNet baseline<br/>[resnet_baseline.py]"]
end

subgraph group_evaluation["Evaluation and audit"]
  node_predictions["Prediction files"]
  node_prediction_check["Prediction validation<br/>[io.py]"]
  node_duplicate_audit["Duplicate audit<br/>[duplicates.py]"]
  node_metrics["Metric calculations<br/>[metrics.py]"]
  node_scoreboard["Scoreboard and reports<br/>[report.py]"]
end

subgraph group_shared["Shared infrastructure"]
  node_config["Experiment config<br/>[config.py]"]
  node_paths["Project paths<br/>[paths.py]"]
end

node_researcher(("Researcher"))
node_source_images[("Image dataset")]

node_researcher -->|"builds split"| node_split
node_source_images -->|"supplies files"| node_split
node_researcher -->|"trains models"| node_g2_train
node_split -->|"defines benchmark"| node_g2_train
node_g2_train -->|"loads features"| node_g2_features
node_g2_train -->|"builds pipeline"| node_g2_models
node_g2_features -->|"uses masks"| node_g2_masks
node_g2_train -->|"writes predictions"| node_predictions
node_researcher -->|"trains models"| node_g3_train
node_split -->|"defines benchmark"| node_g3_train
node_g3_train -->|"builds network"| node_g3_models
node_g3_models -->|"uses attention"| node_g3_cbam
node_g3_train -->|"writes predictions"| node_predictions
node_g1 -.->|"provides results"| node_predictions
node_researcher -->|"checks predictions"| node_prediction_check
node_predictions -->|"validates format"| node_prediction_check
node_researcher -->|"audits duplicates"| node_duplicate_audit
node_split -->|"provides split"| node_duplicate_audit
node_researcher -->|"evaluates results"| node_scoreboard
node_predictions -->|"scores predictions"| node_scoreboard
node_scoreboard -->|"reads contract"| node_prediction_check
node_scoreboard -->|"computes metrics"| node_metrics
node_duplicate_audit -->|"supports de-dup scoring"| node_scoreboard
node_config -->|"resolves config"| node_paths

click node_split "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/data/splits.py"
click node_g1 "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g1/api.py"
click node_g2_train "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/training.py"
click node_g2_features "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/features.py"
click node_g2_masks "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/segmentation.py"
click node_g2_models "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/models.py"
click node_g3_train "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/train.py"
click node_g3_models "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/models.py"
click node_g3_cbam "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/cbam.py"
click node_g3_resnet "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/resnet_baseline.py"
click node_predictions "https://github.com/saqibshouqi/gemstone-classification-evolution/tree/main/results/preds"
click node_prediction_check "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/evaluation/io.py"
click node_duplicate_audit "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/data/duplicates.py"
click node_metrics "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/evaluation/metrics.py"
click node_scoreboard "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/evaluation/report.py"
click node_config "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/config.py"
click node_paths "https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/paths.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_split toneBlue
class node_g1,node_g2_train,node_g2_features,node_g2_masks,node_g2_models,node_g3_train,node_g3_models,node_g3_cbam,node_g3_resnet,node_source_images toneAmber
class node_predictions,node_prediction_check,node_duplicate_audit,node_metrics,node_scoreboard toneMint
class node_config,node_paths toneRose
class node_researcher toneIndigo
```

## Components

### Benchmark protocol

- [Canonical split](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/data/splits.py): `src/gemstone_trends/data/splits.py`

### Classification methods

- [G1 methods](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g1/api.py): `src/g1/api.py`
- [G2 training](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/training.py): `src/g2/training.py`
- [G2 features](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/features.py): `src/g2/features.py`
- [G2 segmentation](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/segmentation.py): `src/g2/segmentation.py`
- [G2 classifiers](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g2/models.py): `src/g2/models.py`
- [G3 training](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/train.py): `src/g3/train.py`
- [G3 models](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/models.py): `src/g3/models.py`
- [CBAM attention](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/cbam.py): `src/g3/cbam.py`
- [ResNet baseline](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/g3/resnet_baseline.py): `src/g3/resnet_baseline.py`

### Evaluation and audit

- [Prediction files](https://github.com/saqibshouqi/gemstone-classification-evolution/tree/main/results/preds): `results/preds`
- [Prediction validation](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/evaluation/io.py): `src/gemstone_trends/evaluation/io.py`
- [Duplicate audit](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/data/duplicates.py): `src/gemstone_trends/data/duplicates.py`
- [Metric calculations](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/evaluation/metrics.py): `src/gemstone_trends/evaluation/metrics.py`
- [Scoreboard and reports](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/evaluation/report.py): `src/gemstone_trends/evaluation/report.py`

### Shared infrastructure

- [Experiment config](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/config.py): `src/gemstone_trends/config.py`
- [Project paths](https://github.com/saqibshouqi/gemstone-classification-evolution/blob/main/src/gemstone_trends/paths.py): `src/gemstone_trends/paths.py`

### Other components

- **Researcher**
- **Image dataset**

## Connections

- Researcher → Canonical split: builds split (evidence: `README.md`)
- Image dataset → Canonical split: supplies files (evidence: `README.md`)
- Researcher → G2 training: trains models (evidence: `README.md`)
- Canonical split → G2 training: defines benchmark (evidence: `README.md`)
- G2 training → G2 features: loads features (evidence: `src/g2/training.py`)
- G2 training → G2 classifiers: builds pipeline (evidence: `src/g2/training.py`)
- G2 features → G2 segmentation: uses masks (evidence: `src/g2/features.py`)
- G2 training → Prediction files: writes predictions (evidence: `README.md`)
- Researcher → G3 training: trains models (evidence: `README.md`)
- Canonical split → G3 training: defines benchmark (evidence: `README.md`)
- G3 training → G3 models: builds network (evidence: `src/g3/train.py`)
- G3 models → CBAM attention: uses attention (evidence: `src/g3/models.py`)
- G3 training → Prediction files: writes predictions (evidence: `README.md`)
- G1 methods → Prediction files: provides results (evidence: `README.md`)
- Researcher → Prediction validation: checks predictions (evidence: `README.md`)
- Prediction files → Prediction validation: validates format (evidence: `README.md`)
- Researcher → Duplicate audit: audits duplicates (evidence: `README.md`)
- Canonical split → Duplicate audit: provides split (evidence: `src/gemstone_trends/data/duplicates.py`)
- Researcher → Scoreboard and reports: evaluates results (evidence: `README.md`)
- Prediction files → Scoreboard and reports: scores predictions (evidence: `src/gemstone_trends/evaluation/report.py`)
- Scoreboard and reports → Prediction validation: reads contract (evidence: `src/gemstone_trends/evaluation/report.py`)
- Scoreboard and reports → Metric calculations: computes metrics (evidence: `src/gemstone_trends/evaluation/report.py`)
- Duplicate audit → Scoreboard and reports: supports de-dup scoring (evidence: `README.md`)
- Experiment config → Project paths: resolves config (evidence: `src/gemstone_trends/config.py`)
