# salkeomkar578-lab/quantum-secured-pashu-aadhaar architecture

> Architecture diagram of the GitHub repository salkeomkar578-lab/quantum-secured-pashu-aadhaar, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar
- Repository: https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar

## Overview

Quantum Cow is a proof-of-concept for identifying livestock from muzzle images, securing biometric payloads with simulated BB84 QKD and AES, and matching them against a cloud registry. The documented path runs from edge capture through detection, image enhancement, embedding, encryption, offline buffering or transmission, and API-side identification. Benchmarking compares classical and quantum approaches. The README documents the end-to-end flow; sampled code confirms the benchmark, BB84 encryption, and API/database responsibilities. Several phase modules were not sampled, so their internal calls are not inferred.

Main entry points: [`phase4_edge_inference.py`](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_edge_inference.py) (Edge inference), [`phase4_api_server.py`](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_api_server.py) (FastAPI receiver), [`phase1_yolo_detection.py`](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase1_yolo_detection.py) (Muzzle detector), [`phase2_qimp_simulation.py`](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase2_qimp_simulation.py) (QIMP filtering)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_edge["Edge Vision"]
  node_detector["Muzzle detector"]
  node_qimp["QIMP filtering"]
  node_embedder["Biometric embedder"]
  node_edgeflow["Edge inference"]
  node_buffer["Offline payload queue"]
  node_dataset["Muzzle dataset<br/>[data.yaml]"]
end

subgraph group_security["Quantum Security"]
  node_bb84["BB84 key exchange<br/>[phase3_bb84_qkd.py]"]
  node_aes["AES embedding encryption<br/>[phase3_bb84_qkd.py]"]
end

subgraph group_cloud["Cloud Registry"]
  node_api["FastAPI receiver"]
  node_matcher["Cosine identification"]
  node_registry[("Cattle registry")]
end

subgraph group_evaluation["Evaluation"]
  node_benchmark["Pipeline benchmark"]
end

node_camera(("Farm camera"))
node_network(("Cloud connection"))

node_camera -->|"captures images"| node_detector
node_detector -->|"passes muzzle ROI"| node_qimp
node_qimp -->|"passes filtered image"| node_embedder
node_embedder -->|"provides embedding"| node_edgeflow
node_edgeflow -->|"requests secure key"| node_bb84
node_bb84 -->|"derives encryption key"| node_aes
node_edgeflow -->|"encrypts embedding"| node_aes
node_edgeflow -->|"caches offline"| node_buffer
node_edgeflow -->|"sends payload"| node_network
node_buffer -->|"flushes on reconnect"| node_network
node_network -->|"delivers payload"| node_api
node_api -->|"routes identification"| node_matcher
node_matcher -->|"matches against"| node_registry
node_api -->|"registers cattle"| node_registry
node_dataset -.->|"configures training data"| node_detector
node_benchmark -->|"evaluates quantum path"| node_qimp
node_benchmark -->|"evaluates security"| node_bb84

click node_detector "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase1_yolo_detection.py"
click node_qimp "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase2_qimp_simulation.py"
click node_embedder "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase1_embedding_extractor.py"
click node_edgeflow "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_edge_inference.py"
click node_bb84 "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase3_bb84_qkd.py"
click node_aes "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase3_bb84_qkd.py"
click node_buffer "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_edge_inference.py"
click node_api "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_api_server.py"
click node_matcher "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_api_server.py"
click node_registry "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_api_server.py"
click node_benchmark "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/benchmark_pipeline.py"
click node_dataset "https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/dataset/data.yaml"

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_detector,node_qimp,node_embedder,node_edgeflow,node_buffer,node_dataset toneBlue
class node_bb84,node_aes toneAmber
class node_api,node_matcher,node_registry toneMint
class node_benchmark toneRose
class node_camera,node_network toneIndigo
```

## Components

### Edge Vision

- [Muzzle detector](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase1_yolo_detection.py): `phase1_yolo_detection.py`
- [QIMP filtering](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase2_qimp_simulation.py): `phase2_qimp_simulation.py`
- [Biometric embedder](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase1_embedding_extractor.py): `phase1_embedding_extractor.py`
- [Edge inference](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_edge_inference.py): `phase4_edge_inference.py`
- [Offline payload queue](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_edge_inference.py): `phase4_edge_inference.py`
- [Muzzle dataset](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/dataset/data.yaml): `dataset/data.yaml`

### Quantum Security

- [BB84 key exchange](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase3_bb84_qkd.py): `phase3_bb84_qkd.py`
- [AES embedding encryption](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase3_bb84_qkd.py): `phase3_bb84_qkd.py`

### Cloud Registry

- [FastAPI receiver](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_api_server.py): `phase4_api_server.py`
- [Cosine identification](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_api_server.py): `phase4_api_server.py`
- [Cattle registry](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/phase4_api_server.py): `phase4_api_server.py`

### Evaluation

- [Pipeline benchmark](https://github.com/salkeomkar578-lab/quantum-secured-pashu-aadhaar/blob/main/benchmark_pipeline.py): `benchmark_pipeline.py`

### Other components

- **Farm camera**
- **Cloud connection**

## Connections

- Farm camera → Muzzle detector: captures images (evidence: `README.md`)
- Muzzle detector → QIMP filtering: passes muzzle ROI (evidence: `README.md`)
- QIMP filtering → Biometric embedder: passes filtered image (evidence: `README.md`)
- Biometric embedder → Edge inference: provides embedding (evidence: `README.md`)
- Edge inference → BB84 key exchange: requests secure key (evidence: `README.md`)
- BB84 key exchange → AES embedding encryption: derives encryption key (evidence: `phase3_bb84_qkd.py`)
- Edge inference → AES embedding encryption: encrypts embedding (evidence: `README.md`)
- Edge inference → Offline payload queue: caches offline (evidence: `README.md`)
- Edge inference → Cloud connection: sends payload (evidence: `README.md`)
- Offline payload queue → Cloud connection: flushes on reconnect (evidence: `README.md`)
- Cloud connection → FastAPI receiver: delivers payload (evidence: `README.md`)
- FastAPI receiver → Cosine identification: routes identification (evidence: `README.md`)
- Cosine identification → Cattle registry: matches against (evidence: `README.md`)
- FastAPI receiver → Cattle registry: registers cattle (evidence: `phase4_api_server.py`)
- Muzzle dataset → Muzzle detector: configures training data (evidence: `README.md`)
- Pipeline benchmark → QIMP filtering: evaluates quantum path (evidence: `benchmark_pipeline.py`)
- Pipeline benchmark → BB84 key exchange: evaluates security (evidence: `benchmark_pipeline.py`)
