# manojgowda2000/pcb_defects_detection_using_yolo_model architecture

> Architecture diagram of the GitHub repository manojgowda2000/pcb_defects_detection_using_yolo_model, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/manojgowda2000/pcb_defects_detection_using_yolo_model
- Repository: https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model

## Overview

##### Project Type and Purpose
- Type: Machine-learning pipeline + lightweight inference UI
- Purpose: Automate PCB defect detection using YOLOv8 (object-detection) with transfer learning, and expose inference via a small web app.

##### File Structure
- Top-level scripts:
– train.py: orchestrates dataset loading, model fine-tuning, checkpoint saving
– app.py / streamlit.py: inference server or Streamlit UI for real-time detection
– main.ipynb: exploratory data analysis and prototyping
- Support files:
– requirements.txt: lists Python dependencies (ultralytics, torch, streamlit, etc.)
– test_images/: sample images folder for inference/testing
- Missing but implied:
– A data/ or custom dataset directory (described in README)

##### README for Additional Insights
- Workflow stages: Prepare data → Train (train.py) → Evaluate (viz.py) → Inference (app.py/streamlit.py)
- Key libraries: YOLOv8, PyTorch, Streamlit, Kaggle-sourced/custom annotated images
- Outputs: model checkpoints, inference results, real-time UI

##### Main Components
a. Data Ingestion
– Raw images (Kaggle + custom) in data/
– test_images/ for quick inference
b. Training Pipeline
– train.py calls YOLOv8 API (Ultralytics)
– Transfer learning: load pre-trained weights → fine-tune on PCB dataset
– Outputs: model artifacts (weights, logs)
c. Model Evaluation / Visualization
– viz.py or main.ipynb for metrics plots, confusion matrices, sample detections
d. Inference Service / Web UI
– app.py or streamlit.py
– Loads trained model → processes incoming image → returns annotated output
e. External Services / Libraries
– Ultralytics YOLOv8 (API calls)
– PyTorch (compute backend)
– Streamlit (web UI)

##### Architectural Patterns and Design Principles
- Separation of concerns: Training vs. Inference
- Modularity: visualization and UI layer abstracted from core ML code
- Reproducibility: requirements.txt + git versioning
- Pipeline orientation: clearly delineated stages for data, compute, and serving

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Stores
    D1["Raw Data (data/)"]:::data
    D2["Test Images"]:::data

    %% Compute Modules
    C1["Training Pipeline<br>train.py"]:::compute
    A1["Model Artifacts<br>(Weights & Logs)"]:::data

    subgraph "Visualization Module"
        V1["viz.py"]:::compute
        V2["main.ipynb"]:::compute
    end

    subgraph "Inference Layer"
        S1["Inference API<br>app.py"]:::compute
        S2["Streamlit UI<br>streamlit.py"]:::ui
    end

    %% Documentation
    Doc1["requirements.txt"]:::doc
    Doc2["README.md"]:::doc

    %% Data and Process Flows
    D1 --> C1
    C1 --> A1
    A1 --> S1
    D2 --> S1
    A1 --> V1
    A1 --> V2
    D1 -.-> V1
    D1 -.-> V2
    S1 --> S2

    %% Click Events
    click D2 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/tree/main/test_images/"
    click C1 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/blob/main/train.py"
    click V1 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/blob/main/viz.py"
    click V2 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/blob/main/main.ipynb"
    click S1 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/blob/main/app.py"
    click S2 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/blob/main/streamlit.py"
    click Doc1 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/blob/main/requirements.txt"
    click Doc2 "https://github.com/manojgowda2000/pcb_defects_detection_using_yolo_model/blob/main/README.md"

    %% Styles
    classDef data fill:#CCE5FF,stroke:#3399FF,color:#000;
    classDef compute fill:#DFFFCF,stroke:#33CC33,color:#000;
    classDef ui fill:#FFE5CC,stroke:#FF9933,color:#000;
    classDef doc fill:#F2F2F2,stroke:#CCCCCC,color:#000;
```
