# jinensetpal/lint architecture

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

- Interactive diagram: https://gitdiagram.com/jinensetpal/lint
- Repository: https://github.com/jinensetpal/lint

## Overview

##### Main Components
- Data Management and Versioning:
- Use of DVC with files like .dvc, dvc.yaml, and dvc.lock.
- Data directories (data/ and its subfolders) that include annotations, training and test splits, and generated CAM outputs.
- Model Training Pipeline:
- Training component that is triggered via the command “python -m src.model.train {camloss|default}”.
- Core training script (src/model/train.py) and emphasize the modular design which includes:
▸ Model Architecture (src/model/arch.py)
▸ Loss Functions (src/model/loss.py and src/auxilliary/loss.py)
▸ Evaluation/Prediction Modules (src/model/evaluate.py & src/model/predict.py)
- That the training strategy uses feedback loops generated from CAMs.
- Data Preprocessing and Augmentation:
- Data handling modules in src/data (e.g., waterbirds.py and siamese.py) and also note the augment.py script in the package documentation section of the README.
- How these modules prepare inputs for the training pipeline.
- CAMs Generation and Evaluation:
- Generator (src/data/generator.py) responsible for computing and evaluating Class Activation Mappings.
- Relationship with the trained model (stored under models/) and how CAMs are used as a feedback signal.
- Output and Artifacts:
- That trained models are saved under the models/ directory.
- Optionally, include the role of documentation and reporting through the paper/ and slides/ directories, which provide figures and a write-up of the experiments.

##### Noting Architectural Patterns
- Modularization: Explain that the code is structured into packages (src/data, src/model, src/auxilliary, etc.) to encapsulate functionality.
- Experimentation Workflow: Clarify that the system is designed to switch training strategies easily (default vs. camloss) with minimal changes at runtime.
- Pipeline Management: Emphasize the use of DVC which signals a data lifecycle management strategy integrated within the design.

##### Extra Detail to Capture
- Version control and dependency management aspects (requirements.txt, .gitignore) to reflect the reproducibility and standard practices in research environments.
- Mention how the overall flow is executed using command-line calls with the “-m” flag for running the package.
- Auxiliary scripts and their role (for instance, colab_setup.sh indicates potential cloud-based evaluations).

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Data Management & Preprocessing"
        DVCData["DVC Files & Data Directory"]:::data
        PreprocWB["Waterbirds Preprocessing - src/data/waterbirds.py"]:::process
        PreprocSiam["Siamese Preprocessing - src/data/siamese.py"]:::process
        DVCData --> PreprocWB
        DVCData --> PreprocSiam
    end

    subgraph "Model Training Pipeline"
        Train["Model Training (camloss|default) - src/model/train.py"]:::process
        Arch["Model Architecture - src/model/arch.py"]:::process
        LossModel["Loss Functions (Model) - src/model/loss.py"]:::process
        LossAux["Loss Functions (Aux) - src/auxilliary/loss.py"]:::process
        Evaluate["Evaluation Module - src/model/evaluate.py"]:::process
        PreprocWB --> Train
        PreprocSiam --> Train
        Train --> Arch
        Train --> LossModel
        Train --> LossAux
        Train --> Evaluate
    end

    subgraph "Output & CAMs Feedback"
        Models["Trained Model Output (models/)"]:::data
        CAMGen["CAM Generation - src/data/generator.py"]:::process
        Train --> Models
        Models --> CAMGen
        CAMGen --> Train
    end

    subgraph "Documentation & Reporting"
        Paper["Paper & Write-ups (paper/)"]:::doc
        Slides["Presentation Slides (slides/)"]:::doc
        Models --> Paper
        Models --> Slides
    end

    Aux["Aux Workflow Script - scripts/sbatch.sh"]:::process
    Aux --> Train

    %% Click Events
    click DVCData "https://github.com/jinensetpal/lint/tree/main/data/"
    click Train "https://github.com/jinensetpal/lint/blob/main/src/model/train.py"
    click Arch "https://github.com/jinensetpal/lint/blob/main/src/model/arch.py"
    click LossModel "https://github.com/jinensetpal/lint/blob/main/src/model/loss.py"
    click LossAux "https://github.com/jinensetpal/lint/blob/main/src/auxilliary/loss.py"
    click Evaluate "https://github.com/jinensetpal/lint/blob/main/src/model/evaluate.py"
    click PreprocWB "https://github.com/jinensetpal/lint/blob/main/src/data/waterbirds.py"
    click PreprocSiam "https://github.com/jinensetpal/lint/blob/main/src/data/siamese.py"
    click Aux "https://github.com/jinensetpal/lint/blob/main/scripts/sbatch.sh"
    click Paper "https://github.com/jinensetpal/lint/tree/main/paper/"
    click Slides "https://github.com/jinensetpal/lint/tree/main/slides/"

    %% Class Definitions
    classDef data fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef process fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef doc fill:#FFFFE0,stroke:#000,stroke-width:2px;
```
