# devansh-1010/captcha-reading-cs771 architecture

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

- Interactive diagram: https://gitdiagram.com/devansh-1010/captcha-reading-cs771
- Repository: https://github.com/devansh-1010/captcha-reading-cs771

## Overview

##### Project Type and Purpose
- This is a machine-learning/ data-science project—a CAPTCHA-reading pipeline implemented in a single Jupyter notebook (“Captcha Reading.ipynb”).
- It ingests labeled image data, trains or fine-tunes a model, and produces a submission file of predicted labels on a test set.

##### File-Structure Analysis
- Top level:
- Captcha Reading.ipynb – hosts the entire data-loading, preprocessing, training and inference code.
- README.md – very brief, just the project title.
- Data directories:
- train/labels.txt – ground-truth labels for training images (images presumably co-located or inferred).
- reference/ – likely contains reference images or baseline outputs.
- dummy_submit/ – placeholder for model artifact (model.txt) and test predictions in dummy_submit/test/labels.txt.

##### Key Components
a. Data Sources
– Training images + train/labels.txt
– Reference images (reference/)
– Test images (implicit under dummy_submit/test/)
b. Preprocessing Module
– Image reading
– Resizing, normalization, binarization
c. Model Training Module
– Model architecture definition (e.g., CNN)
– Training loop (epochs, loss computation)
– Saving trained model (dummy_submit/model.txt)
d. Inference Module
– Loading saved model
– Running predictions on test images
– Writing output labels to dummy_submit/test/labels.txt
e. Evaluation or Submission
– (Optional) Comparing predictions against reference/ or computing accuracy
– Packaging results for submission

##### Architectural Patterns and Principles
- Pipeline pattern: linear, staged data processing.
- Separation of concerns: data ingestion/preprocessing, training, inference.
- Reproducibility: notebook serves as orchestrator; model artifact is versioned in dummy_submit/.

##### Technologies and Frameworks (to annotate)
- Jupyter Notebook (or nbs).
- Python libraries you’re using: e.g., OpenCV/Pillow for image I/O, NumPy, TensorFlow/PyTorch or scikit-learn for modeling.
- File-based storage (labels.txt, model.txt).

##### Detail Level
- Be exhaustive: include every folder or file you rely on (train, reference, dummy_submit).
- Data formats (image → array → model weights → text labels).
- Jupyter notebook as the orchestrator that ties all modules together.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Data Sources"
        direction TB
        trainImages["Training Images\n(train/)"]:::data
        trainLabels["Training Labels\n(train/labels.txt)"]:::data
        reference["Reference Images\n(reference/)"]:::data
        testImages["Test Images\n(dummy_submit/test/)"]:::data
    end

    Preprocessor["Preprocessor\n(OpenCV, NumPy)"]:::compute
    Trainer["Model Trainer\n(TensorFlow/PyTorch)"]:::compute
    ModelStore["Model Artifact\n(dummy_submit/model.txt)"]:::storage
    Inference["Inference\n(Predictor)"]:::compute
    Predictions["Predicted Labels\n(dummy_submit/test/labels.txt)"]:::data
    Evaluation["Evaluation\n(Reference vs Predictions)"]:::optional

    trainImages --> Preprocessor
    trainLabels --> Preprocessor
    Preprocessor --> Trainer
    Trainer --> ModelStore
    ModelStore --> Inference
    testImages --> Inference
    Inference --> Predictions
    Predictions --> Evaluation
    reference --> Evaluation

    click trainImages "https://github.com/devansh-1010/captcha-reading-cs771/tree/main/train/"
    click trainLabels "https://github.com/devansh-1010/captcha-reading-cs771/blob/main/train/labels.txt"
    click reference "https://github.com/devansh-1010/captcha-reading-cs771/tree/main/reference/"
    click testImages "https://github.com/devansh-1010/captcha-reading-cs771/tree/main/dummy_submit/test/"
    click Preprocessor "https://github.com/devansh-1010/captcha-reading-cs771/blob/main/Captcha Reading.ipynb"
    click Trainer "https://github.com/devansh-1010/captcha-reading-cs771/blob/main/Captcha Reading.ipynb"
    click ModelStore "https://github.com/devansh-1010/captcha-reading-cs771/blob/main/dummy_submit/model.txt"
    click Inference "https://github.com/devansh-1010/captcha-reading-cs771/blob/main/Captcha Reading.ipynb"
    click Predictions "https://github.com/devansh-1010/captcha-reading-cs771/blob/main/dummy_submit/test/labels.txt"

    classDef data fill:#add8e6,stroke:#333,stroke-width:1px
    classDef compute fill:#90ee90,stroke:#333,stroke-width:1px
    classDef storage fill:#ffa500,stroke:#333,stroke-width:1px
    classDef optional fill:#f5f5f5,stroke:#333,stroke-width:1px
```
