# csyanbin/scot architecture

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

- Interactive diagram: https://gitdiagram.com/csyanbin/scot
- Repository: https://github.com/csyanbin/scot

## Overview

##### Main Components
- Datasets
– All image datasets live under Datasets_SCOT (PF-PASCAL, PF-WILLOW, SPair, TSS)
- Data Module
– data/ (dataset definitions, download scripts, flow utilities)
– dataset.py, download.py, flow.py, pfpascal.py, pfwillow.py, spair.py, tss_dataset.py
- Model Module
– model/ (feature extractor, geometry routines, OT solver wrappers)
– resnet.py (backbone), geometry.py, rhm_map.py, scot_CAM.py, evaluation.py, util.py
- Orchestration Scripts
– evaluate_map_CAM.py, evaluate_map_TSS_CAM.py
– beamsearch.py, cmd.txt (example CLI commands)
- External Libraries
– PyTorch, torchvision, scikit-image, pandas, requests, gluoncv-torch

##### Relationships & Data Flow
- Users invoke a script (evaluate_map_*.py or beamsearch.py) via the CLI.
- Script calls Data Module → loads image pairs from Datasets_SCOT.
- Loaded data is fed into Model Module:
– Backbone extracts hyperpixel features (ResNet or FCN).
– SCOT solver (OTGeo) and geometry routines compute correspondences.
– evaluation.py computes PCK metrics.
- Results (metrics, transformed maps) are output to console/files.

##### Architectural Patterns
- Modular ML Pipeline: clear separation between data I/O, feature extraction, solver, evaluation.
- Pluggable Backbones & Solvers: models use a common interface (backbone + OT layers).

## Diagram (Mermaid)

```mermaid
flowchart TD
    Datasets["Datasets"]:::datasets
    DataLoader["Data Loader"]:::code
    ModelSolver["Model & OT Solver"]:::code
    CLIScripts["CLI Scripts"]:::code
    Outputs["Outputs (Metrics / Maps)"]:::outputs

    Datasets -->|"image pairs"| DataLoader
    DataLoader -->|"features"| ModelSolver
    ModelSolver -->|"correspondences"| Outputs
    CLIScripts -->|"invoke pipeline"| DataLoader
    CLIScripts -->|"show results"| Outputs

    click Datasets "https://github.com/csyanbin/scot/tree/master/Datasets_SCOT/"
    click DataLoader "https://github.com/csyanbin/scot/tree/master/data/"
    click ModelSolver "https://github.com/csyanbin/scot/tree/master/model/"

    classDef code fill:#add8e6,stroke:#000,color:#000
    classDef datasets fill:#98fb98,stroke:#000,color:#000
    classDef outputs fill:#ffa500,stroke:#000,color:#000
```
