# saikrishnathonduru/localization_of_transaprent_cups architecture

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

- Interactive diagram: https://gitdiagram.com/saikrishnathonduru/localization_of_transaprent_cups
- Repository: https://github.com/saikrishnathonduru/localization_of_transaprent_cups

## Overview

Based on our analysis of the provided file tree and README, this project is a machine learning–driven object detection and classification system that uses a modified YOLO (Tiny YOLO v2) architecture to detect and localize transparent cups on a conveyor belt. Its primary purpose is to determine the orientation (lying vs. upright) of cups—information vital for subsequent pick-and-place robotic handling in industrial applications.

##### Main Components

a. Data/Input Layer
- Images/Dataset: Represented by the "Images" folder, which houses sample input images.
- Preprocessing Module: Managed by the file "yolo_preprocessing.py", this component handles image resizing, normalization, and key point extraction from images.

b. Core Detection Pipeline
- YOLO Architecture Implementation: Centralized in "Yolo_main.py" and "yolo_predict.py". These scripts implement the training and inference flows using the YOLO model.
- Model Configuration & Weights: "yolo_config.json" provides parameters for the detection model, while weight files "transparent.h5" and "transparent.h5full" store the trained model parameters.

c. Machine Learning Frameworks & Technologies
- TensorFlow & Keras: As described in the README, the project uses Tensorflow 1.14.0 and Keras 2.3.1 for building and training the neural network.
- OpenCV: Used for all operations related to image manipulation and visualization.
- GPU Support: The system extensively uses GPU support to accelerate training and inference.

##### Relationships and Interactions

- Data Flow:
– The raw images from the "Images" directory enter the Preprocessing Module (yolo_preprocessing.py), where they are prepped for model input.

- Training & Evaluation Cycle:
– The training pipeline (likely initiated by Yolo_main.py) integrates the model configuration (from yolo_config.json) and weights, and uses data from preprocessed images.
– Validation images and statistical outputs (as shown in the README via images and graphs) complete the loop for refining the model.

##### Architectural Patterns and Design Principles

- Modular Pipeline: Each phase (preprocessing, detection, post-processing) is separated into its own Python module, promoting clear separation of concerns.
- End-to-end Real-Time Processing: The design emphasizes fast computation with direct flow from input to output (a “single evaluation” approach as described for YOLO).
- Data Abstraction: The division between data input (images, dataset) and algorithmic components (training, prediction) is clearly maintained.

##### Detailed Component Breakdown

- Data Input / Dataset Module:
- File: Images folder
- Function: Feeding raw images into the system

- Preprocessing Module:
- File: yolo_preprocessing.py
- Function: Image resizing, normalization, keypoint extraction

- YOLO Detection Core:
- Files: Yolo_main.py, yolo_predict.py, and yolo_frontend.py
- Function: Handling model execution and prediction based on the YOLO approach

- Model Configuration & Weights:
- Files: yolo_config.json, transparent.h5, transparent.h5full
- Function: Contain model parameters and trained weights needed for detection

- Utility Module:
- File: yolo_utils.py

- External Frameworks:
- TensorFlow and Keras for building/training the deep learning model
- OpenCV for image operations

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data/Input Layer
    A["Images (Dataset)"]:::data

    %% Preprocessing Module
    B["Preprocessing (yolo_preprocessing.py)"]:::process

    %% YOLO Detection Core Subgraph
    subgraph "YOLO Detection Core"
        C["Model Training (Yolo_main.py)"]:::core
        D["Model Inference (yolo_predict.py)"]:::core
        E["Results Presentation (yolo_frontend.py)"]:::core
    end

    %% Model Configuration & Weights
    F["Model Config (yolo_config.json)"]:::artifact
    G["Model Weights (transparent.h5)"]:::artifact
    H["Model Weights (transparent.h5full)"]:::artifact

    %% Utility Module
    I["Utility Functions (yolo_utils.py)"]:::utility

    %% External Frameworks & Technologies
    J["TensorFlow & Keras"]:::external
    K["OpenCV"]:::external
    L["GPU Support"]:::external

    %% Data Flow Connections
    A -->|"feeds"| B
    B -->|"preprocessedData"| C
    B -->|"preprocessedData"| D

    %% YOLO Core Internal Connections
    C -->|"modelOutput"| D
    D -->|"results"| E

    %% Configuration & Weights Feeding into YOLO Core
    F -->|"configures"| C
    F -->|"configures"| D
    G -->|"providesWeights"| C
    G -->|"providesWeights"| D
    H -->|"providesWeights"| C
    H -->|"providesWeights"| D

    %% Utility Module Supporting Preprocessing & YOLO Modules
    I ---|"supports"| B
    I ---|"supports"| C
    I ---|"supports"| D
    I ---|"supports"| E

    %% External Libraries supporting Processing and Model Execution
    J -->|"supports"| C
    J -->|"supports"| D
    K -->|"supports"| B
    K -->|"supports"| I
    L -->|"accelerates"| C
    L -->|"accelerates"| D

    %% Click Events for Component Mapping
    click A "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/tree/main/Images/"
    click B "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/yolo_preprocessing.py"
    click C "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/Yolo_main.py"
    click D "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/yolo_predict.py"
    click E "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/yolo_frontend.py"
    click F "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/yolo_config.json"
    click G "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/transparent.h5"
    click H "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/transparent.h5full"
    click I "https://github.com/saikrishnathonduru/localization_of_transaprent_cups/blob/main/yolo_utils.py"

    %% Styles
    classDef data fill:#f9e79f,stroke:#d35400,stroke-width:2px;
    classDef process fill:#aed6f1,stroke:#2471a3,stroke-width:2px;
    classDef core fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef artifact fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px;
    classDef utility fill:#fad7a0,stroke:#e67e22,stroke-width:2px;
    classDef external fill:#d2b4de,stroke:#8e44ad,stroke-width:2px;
```
