# samiurprapon/brasizeprediction architecture

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

- Interactive diagram: https://gitdiagram.com/samiurprapon/brasizeprediction
- Repository: https://github.com/samiurprapon/brasizeprediction

## Overview

##### Project type and purpose
- This is an offline-first machine-learning image-processing project (“BraSizePrediction”) implemented in Python/Jupyter notebooks. Its eventual goal is to port the trained neural network to an Android app for real-time bra-size prediction without sending data off the device.

##### File structure
- Top-level artifacts:
- Jupyter notebooks (Main.ipynb, Bra Detection.ipynb, etc.) for EDA, preprocessing, model training and evaluation
- Model weight files (.h5) for two variants: `bra_dection_mobileNetV2.h5` and `bra_dection_mobileNetV2_improvised.h5`
- `dataset/` directory with two subfolders (with_bra, without_bra) containing raw image data
- `data.csv` and `measurements.txt` for meta-data labeling
- `testsets` folder for hold-out validation sets
- `docs/` with a proposal PPTX
- No dedicated “src” directory or microservices—this is a monolithic ML research repository.

##### README for additional insights
- Describes 100% offline operation, privacy emphasis, future Android port.
- Uses a MobileNetV2 backbone for quick on-device inference.

##### Main components
a. Data Ingestion & Storage
- Raw images in `dataset/with_bra` and `dataset/without_bra`
- Metadata in `data.csv` & `measurements.txt`
b. Preprocessing & Augmentation
- Jupyter notebooks handle resizing, normalization, on-the-fly augmentations (rotate, flip, brightness)
c. Model Training Pipeline
- MobileNetV2 (Keras/TensorFlow) backbone
- Notebook orchestrates training loop, callbacks, checkpoints
- Final weight files stored as `.h5` artifacts
d. Model Artifact Repository
- Versioned .h5 files alongside notebooks for reproducibility
e. Evaluation & Testing
- Testsets folder used for final accuracy, confusion matrices, metrics logging
f. Inference Engine / Mobile App
- Android app embedding TensorFlow Lite model (converted from .h5)
- On-device preprocessing module
- Real-time camera feed → prediction → UI display

##### Relationships & interactions
- Preprocessing → Training Pipeline
- Training Pipeline → Model Artifacts
- Model Artifacts → TFLite conversion → Mobile App
- Mobile App ↔ On-device inference (no network call)

##### Architectural patterns & design principles
- ML pipeline pattern: clear separation of data ingestion, preprocessing, training, inference
- Offline-first principle: the mobile app must embed all models and data transformations locally
- Modular notebooks for reproducibility and iterative experimentation
- Model versioning: store multiple .h5 variants to compare performance

##### Technologies, frameworks & libraries
- Python, Jupyter Notebook for prototyping
- TensorFlow/Keras for CNN (MobileNetV2)
- Pandas & OpenCV/Pillow for data preprocessing
- TensorFlow Lite for Android deployment
- Git for version control

##### Detail
- Major file groups (notebooks, datasets, model weights, docs)
- How switching between `.h5` variants fits into a versioned training cycle
- Offline-only data flow—no external API or cloud dependency

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Data Layer"
        D1["Dataset: with_bra"]:::data
        D2["Dataset: without_bra"]:::data
        D3["Metadata: data.csv"]:::data
        D4["Measurements: measurements.txt"]:::data
    end

    subgraph "Processing Layer"
        P1["Notebook: Main.ipynb"]:::compute
        P2["Notebook: Bra Detection.ipynb"]:::compute
        P3["Notebook: bra_Detection_combine.ipynb"]:::compute
    end

    subgraph "Training Layer"
        T1["Notebook: bra_Detection_mobileNetV2_improvised.ipynb\n(MobileNetV2,224×224)"]:::compute
    end

    subgraph "Artifact Layer"
        A1["Model Artifact: bra_dection_mobileNetV2.h5"]:::artifact
        A2["Model Artifact: bra_dection_mobileNetV2_improvised.h5"]:::artifact
    end

    subgraph "Evaluation Layer"
        E1["Test Sets: testsets/"]:::data
        E2["Evaluation & Metrics"]:::compute
    end

    subgraph "Deployment Layer"
        C1["TFLite Conversion"]:::compute
        M1["Android App & On-device Inference"]:::deploy
    end

    subgraph "Documentation"
        Doc1["README.md"]:::docs
        Doc2["LICENSE"]:::docs
        Doc3["Proposal PPTX"]:::docs
    end

    D1 --> P1
    D2 --> P1
    D3 --> P1
    D4 --> P1
    P1 --> P2
    P2 --> P3
    P3 --> T1
    T1 --> A1
    T1 --> A2
    A1 --> E2
    A2 --> E2
    E1 --> E2
    A1 --> C1
    A2 --> C1
    C1 --> M1

    click D1 "https://github.com/samiurprapon/brasizeprediction/tree/master/dataset/with_bra"
    click D2 "https://github.com/samiurprapon/brasizeprediction/tree/master/dataset/without_bra"
    click D3 "https://github.com/samiurprapon/brasizeprediction/blob/master/data.csv"
    click D4 "https://github.com/samiurprapon/brasizeprediction/blob/master/measurements.txt"
    click P1 "https://github.com/samiurprapon/brasizeprediction/blob/master/Main.ipynb"
    click P2 "https://github.com/samiurprapon/brasizeprediction/blob/master/Bra Detection.ipynb"
    click P3 "https://github.com/samiurprapon/brasizeprediction/blob/master/bra_Detection_combine.ipynb"
    click T1 "https://github.com/samiurprapon/brasizeprediction/blob/master/bra_Detection_mobileNetV2_improvised.ipynb"
    click A1 "https://github.com/samiurprapon/brasizeprediction/blob/master/bra_dection_mobileNetV2.h5"
    click A2 "https://github.com/samiurprapon/brasizeprediction/blob/master/bra_dection_mobileNetV2_improvised.h5"
    click E1 "https://github.com/samiurprapon/brasizeprediction/tree/master/testsets/"
    click Doc1 "https://github.com/samiurprapon/brasizeprediction/blob/master/README.md"
    click Doc2 "https://github.com/samiurprapon/brasizeprediction/tree/master/LICENSE"
    click Doc3 "https://github.com/samiurprapon/brasizeprediction/blob/master/docs/proposal Group - 3.pptx"

    classDef data fill:#D0E1FF,stroke:#0366d6,color:#0366d6
    classDef compute fill:#DFFFD6,stroke:#28a745,color:#28a745
    classDef artifact fill:#FFD8A8,stroke:#d46a06,color:#d46a06
    classDef deploy fill:#E3D0FF,stroke:#6f42c1,color:#6f42c1
    classDef docs fill:#F0F0F0,stroke:#6a737d,color:#6a737d
```
