# ushasi/siamese-spatial-graph-convolution-network architecture

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

- Interactive diagram: https://gitdiagram.com/ushasi/siamese-spatial-graph-convolution-network
- Repository: https://github.com/ushasi/siamese-spatial-graph-convolution-network

## Overview

##### Project type and purpose
- This is a research‐oriented Python/Matlab‐data pipeline implementing a Siamese graph convolutional network (GCN) plus an MLP for remote sensing image retrieval.
- The README confirms:
- It loads precomputed graph features from PatternNet/UC-Merced datasets
- It trains a Siamese MLP on top of those graph features
- It reports retrieval MAP and precision metrics

##### File structure
- Top level:
- .mat files (X_train.mat, y_train.mat, pattGCN.mat, etc.) act as data sources.
- main.py orchestrates end-to-end pipeline.
- input_data.py handles reading .mat files and splitting train/test.
- GCN-singlelabel/graphcnn:
- layers.py, network.py, network_description.py define the core GCN architecture.
- helper.py contains utility functions.
- experiment_multilabel.py runs experiments on multilabel data (evaluation and logging).
- GCN-singlelabel/graphcnn/setup:
- helper.py, ucmerced.py and ucmerced_new.py build adjacency matrices and feature graphs from raw datasets.

##### README for additional insights
- Data → Graph Construction → GCN feature extraction → Siamese MLP → Retrieval/evaluation.
- Key stack: Python, TensorFlow, Matlab data.

##### Detail
- Every script group: show graphcnn/setup as a submodule under Preprocessing
- That experiment_multilabel.py consumes both the trained model and test split

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Data Sources Layer
    subgraph "Data Sources"
        direction TB
        DS1["Root .mat files"]:::dataModule
        DS2["GCN-singlelabel/dataset/pattlabels.mat"]:::dataModule
    end

    %% Preprocessing / Graph Builder Layer
    subgraph "Preprocessing / Graph Builder"
        direction TB
        P1["helper.py"]:::dataModule
        P2["ucmerced.py"]:::dataModule
        P3["ucmerced_new.py"]:::dataModule
    end

    %% Graph Convolutional Network Layer
    subgraph "Graph Convolutional Network (GCN)"
        direction TB
        GCN1["layers.py"]:::modelModule
        GCN2["network.py"]:::modelModule
        GCN3["network_description.py"]:::modelModule
        GCN4["helper.py"]:::modelModule
    end

    %% Siamese MLP Network Layer
    subgraph "Siamese MLP Network"
        direction TB
        S1["main.py"]:::modelModule
        S2["input_data.py"]:::modelModule
    end

    %% Experiment / Evaluation Layer
    subgraph "Experiment / Evaluation"
        direction TB
        E1["experiment_multilabel.py"]:::evalModule
    end

    %% Data Flow
    DS1 -->|".mat → adjacency & features"| P1
    DS1 -->|".mat → adjacency & features"| P2
    DS1 -->|".mat → adjacency & features"| P3
    DS2 -->|".mat → adjacency & features"| P1
    P1 -->|"Adjacency & feature matrices"| GCN1
    P2 -->|"Adjacency & feature matrices"| GCN1
    P3 -->|"Adjacency & feature matrices"| GCN1
    GCN1 -->|"Feature embeddings (N×F)"| S1
    GCN2 -->|"Feature embeddings (N×F)"| S1
    GCN3 -->|"Feature embeddings (N×F)"| S1
    GCN4 -->|"Feature embeddings (N×F)"| S1
    S1 -->|"Embeddings → Siamese network"| S2
    S2 -->|"Trained model"| E1
    E1 -->|"Retrieval results (MAP & precision)"| E1

    %% Click Events
    click DS1 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/X_train.mat"
    click DS2 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/dataset/pattlabels.mat"
    click P1 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/setup/helper.py"
    click P2 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/setup/ucmerced.py"
    click P3 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/setup/ucmerced_new.py"
    click GCN1 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/layers.py"
    click GCN2 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/network.py"
    click GCN3 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/network_description.py"
    click GCN4 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/helper.py"
    click S1 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/main.py"
    click S2 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/input_data.py"
    click E1 "https://github.com/ushasi/siamese-spatial-graph-convolution-network/blob/master/GCN-singlelabel/graphcnn/experiment_multilabel.py"

    %% Styles
    classDef dataModule fill:#D6EAF8,stroke:#2980B9,color:#154360
    classDef modelModule fill:#D5F5E3,stroke:#27AE60,color:#1E8449
    classDef evalModule fill:#FCF3CF,stroke:#F1C40F,color:#7D6608
```
