# thangnch/miai_money_classify architecture

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

- Interactive diagram: https://gitdiagram.com/thangnch/miai_money_classify
- Repository: https://github.com/thangnch/miai_money_classify

## Overview

##### Project type and purpose
- This is a small machine-learning classification pipeline built around transfer learning with VGG16.
- It ingests an image dataset of currency, preprocesses it, trains a model, and runs inference on camera or test images.

##### Main components
a. Data Ingestion & Preparation
- Source: raw images
- Script: make_data.py
- Output: organized training/validation folders or TFRecords
b. Model Training
- Framework: TensorFlow/Keras with VGG16 as base
- Script: train.py
- Output: saved model weights, training logs
c. Inference / Testing
- Script: test.py
- Inputs: live camera feed or test images
- Outputs: predicted class labels, confidence scores
d. Environment / Deployment
- Dependencies listed in setup.txt
- Potential container or virtual environment

##### Architectural patterns and principles
- Pipeline pattern: distinct stages (prepare, train, infer)
- Separation of concerns: each script has a single responsibility
- Modularity: easy to swap out data-prep or backbone model
- Reusability: saved model can be deployed or further fine-tuned

[ ] Call out key technologies: VGG16, TensorFlow/Keras, Python scripts

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Data Preparation Stage
    subgraph "Data Preparation"
        direction TB
        RawImages["Raw Images"]:::external
        MakeData["make_data.py"]:::data
        Preprocessed["Preprocessed Dataset"]:::data
    end

    RawImages -->|"images"| MakeData
    MakeData -->|"augmented images"| Preprocessed

    %% Model Training Stage
    subgraph "Model Training"
        direction TB
        Train["train.py\n(VGG16 Transfer Learning)"]:::train
        SavedModel["Saved Model\n(weights, logs)"]:::train
    end

    Preprocessed -->|"TFRecords / folders"| Train
    Train -->|"model weights, logs"| SavedModel

    %% Inference Stage
    subgraph "Inference"
        direction TB
        Camera["Camera Input"]:::external
        Test["test.py"]:::infer
        Results["Classification Results"]:::infer
    end

    Camera -->|"live images"| Test
    SavedModel -->|"model weights"| Test
    Test -->|"labels, confidence"| Results

    %% Environment / Dependencies
    Setup["setup.txt"]:::env
    Setup -.-> MakeData
    Setup -.-> Train
    Setup -.-> Test

    %% Legend
    subgraph Legend
        direction TB
        DP["Data Pipeline"]:::data
        MT["Model Training"]:::train
        INF["Inference"]:::infer
        ENV["Environment"]:::env
    end

    %% Click Events
    click MakeData "https://github.com/thangnch/miai_money_classify/blob/master/make_data.py"
    click Train "https://github.com/thangnch/miai_money_classify/blob/master/train.py"
    click Test "https://github.com/thangnch/miai_money_classify/blob/master/test.py"
    click Setup "https://github.com/thangnch/miai_money_classify/blob/master/setup.txt"

    %% Styles
    classDef data fill:#D0E7FF,stroke:#0066CC;
    classDef train fill:#D0F0D0,stroke:#009900;
    classDef infer fill:#FFE5CC,stroke:#FF6600;
    classDef env stroke-dasharray:5 5,fill:#F0F0F0,stroke:#999999;
    classDef external fill:#FFFFFF,stroke:#666666,stroke-dasharray:2 2;
```
