# marwarashwan/industrial-quality-inspection. architecture

> Architecture diagram of the GitHub repository marwarashwan/industrial-quality-inspection., generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/marwarashwan/industrial-quality-inspection.
- Repository: https://github.com/marwarashwan/industrial-quality-inspection.

## Overview

This repository is an image-based manufacturing inspection tool, with a gear-detection and batch-analysis workflow alongside a simpler contour-inspection script. The principal documented workflow reads component images, extracts shape features, classifies gears, and writes annotated images and inspection reports; review labels can feed later training. Most advanced gear functionality is described in `src/gear_inspector.py`, whose excerpt is incomplete. `src/batch_inspector.py` references `gear_core` and `synth`, which are absent from the supplied tree, so its integration is not mapped. The README’s conveyor rejection capability is aspirational, not evidenced as implemented.

Main entry points: [`src/gear_inspector.py`](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py) (Gear Batch Runner), [`src/inspector.py`](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/inspector.py) (Contour Inspector), [`src/images`](https://github.com/marwarashwan/industrial-quality-inspection./tree/main/src/images) (Component Images), [`src/Output_Results Pics`](https://github.com/marwarashwan/industrial-quality-inspection./tree/main/src/Output_Results%20Pics) (Annotated Images)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inspection["Image Inspection"]
  node_gear_runner["Gear Batch Runner<br/>[gear_inspector.py]"]
  node_segmentation["Shape Segmentation<br/>[gear_inspector.py]"]
  node_features["Shape Features<br/>[gear_inspector.py]"]
  node_classification["Gear Classification<br/>[gear_inspector.py]"]
  node_simple_inspection["Contour Inspector<br/>[inspector.py]"]
end

subgraph group_learning["Gear Learning"]
  node_synthetic_data["Synthetic Training Data<br/>[gear_inspector.py]"]
  node_model_training["Model Training<br/>[gear_inspector.py]"]
  node_model_artifact[("Trained Model<br/>[gear_inspector.py]")]
end

subgraph group_outputs["Results and Review"]
  node_review_labels["Review Labels<br/>[review_me.csv]"]
  node_inspection_results["Inspection Reports"]
  node_gear_parameters["Gear Parameters<br/>[gear_params.json]"]
  node_annotated_images["Annotated Images"]
end

node_operator(("Operator"))
node_component_images["Component Images"]

node_operator -->|"runs batch inspection"| node_gear_runner
node_component_images -->|"supplies images"| node_gear_runner
node_gear_runner -->|"segments shapes"| node_segmentation
node_segmentation -->|"extracts contours"| node_features
node_features -->|"provides features"| node_classification
node_gear_runner -->|"classifies parts"| node_classification
node_model_artifact -->|"loads model"| node_gear_runner
node_gear_runner -->|"writes report"| node_inspection_results
node_gear_runner -->|"writes parameters"| node_gear_parameters
node_gear_runner -->|"writes annotations"| node_annotated_images
node_operator -->|"runs inspection"| node_simple_inspection
node_component_images -->|"supplies image"| node_simple_inspection
node_simple_inspection -->|"saves contours"| node_annotated_images
node_synthetic_data -->|"provides examples"| node_model_training
node_model_training -->|"saves model"| node_model_artifact
node_review_labels -->|"supplies corrections"| node_gear_runner
node_gear_runner -->|"retrain from labels"| node_model_training

click node_component_images "https://github.com/marwarashwan/industrial-quality-inspection./tree/main/src/images"
click node_gear_runner "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py"
click node_segmentation "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py"
click node_features "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py"
click node_classification "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py"
click node_simple_inspection "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/inspector.py"
click node_synthetic_data "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py"
click node_model_training "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py"
click node_model_artifact "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py"
click node_review_labels "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/Sample_testing/review_me.csv"
click node_inspection_results "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/Sample_testing/inspection_summary.csv"
click node_gear_parameters "https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/Sample_testing/gear_params.json"
click node_annotated_images "https://github.com/marwarashwan/industrial-quality-inspection./tree/main/src/Output_Results%20Pics"

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_gear_runner,node_segmentation,node_features,node_classification,node_simple_inspection toneBlue
class node_synthetic_data,node_model_training,node_model_artifact toneAmber
class node_review_labels,node_inspection_results,node_gear_parameters,node_annotated_images toneMint
class node_operator toneIndigo
class node_component_images toneTeal
```

## Components

### Image Inspection

- [Gear Batch Runner](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py): `src/gear_inspector.py`
- [Shape Segmentation](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py): `src/gear_inspector.py`
- [Shape Features](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py): `src/gear_inspector.py`
- [Gear Classification](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py): `src/gear_inspector.py`
- [Contour Inspector](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/inspector.py): `src/inspector.py`

### Gear Learning

- [Synthetic Training Data](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py): `src/gear_inspector.py`
- [Model Training](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py): `src/gear_inspector.py`
- [Trained Model](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/gear_inspector.py): `src/gear_inspector.py`

### Results and Review

- [Review Labels](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/Sample_testing/review_me.csv): `src/Sample_testing/review_me.csv`
- [Inspection Reports](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/Sample_testing/inspection_summary.csv): `src/Sample_testing/inspection_summary.csv`
- [Gear Parameters](https://github.com/marwarashwan/industrial-quality-inspection./blob/main/src/Sample_testing/gear_params.json): `src/Sample_testing/gear_params.json`
- [Annotated Images](https://github.com/marwarashwan/industrial-quality-inspection./tree/main/src/Output_Results%20Pics): `src/Output_Results Pics`

### Other components

- **Operator**
- [Component Images](https://github.com/marwarashwan/industrial-quality-inspection./tree/main/src/images): `src/images`

## Connections

- Operator → Gear Batch Runner: runs batch inspection
- Component Images → Gear Batch Runner: supplies images
- Gear Batch Runner → Shape Segmentation: segments shapes
- Shape Segmentation → Shape Features: extracts contours
- Shape Features → Gear Classification: provides features
- Gear Batch Runner → Gear Classification: classifies parts
- Trained Model → Gear Batch Runner: loads model
- Gear Batch Runner → Inspection Reports: writes report
- Gear Batch Runner → Gear Parameters: writes parameters
- Gear Batch Runner → Annotated Images: writes annotations
- Operator → Contour Inspector: runs inspection
- Component Images → Contour Inspector: supplies image
- Contour Inspector → Annotated Images: saves contours
- Synthetic Training Data → Model Training: provides examples
- Model Training → Trained Model: saves model
- Review Labels → Gear Batch Runner: supplies corrections
- Gear Batch Runner → Model Training: retrain from labels
