# tami-uib/marnet architecture

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

- Interactive diagram: https://gitdiagram.com/tami-uib/marnet
- Repository: https://github.com/tami-uib/marnet

## Overview

##### Main Components

a) Data Flow Components:
- Input Layer (Two branches)
- Panchromatic (PAN) Image Input (High Resolution)
- Multispectral (MS)/Hyperspectral (HS) Image Input (Low Resolution)

b) Network Architecture Components:
- Unfolding Module
- Upsampling Layer (PAN-guided)
- Downsampling Layer (PAN-guided)
- MARNet Core
- Multi-Head Attention Blocks
- Residual Learning Paths
- Post-processing Module
- Secondary MARNet Architecture

##### Specific Elements

a) Input Processing:
- Parallel paths for PAN and MS/HS inputs
- Resolution differences

b) Core Architecture:
- Detail the unfolding process
- Multi-head attention mechanism
- Residual connections
- Proximity operator replacement

c) Output Generation:
- Fusion process
- Post-processing enhancement

##### Important Labels

- Resolution specifications
- Number of attention heads
- Layer dimensions
- Processing block types

##### Technical Details to Highlight

- Variational formulation components
- Observation model integration
- High-frequency injection points
- Patch-based operations
- Self-similarity exploitation points

## Diagram (Mermaid)

```mermaid
graph TB
    %% Input Layer
    subgraph Input
        PAN[("PAN Image<br/>High Resolution")]:::input
        MS[("MS/HS Image<br/>Low Resolution")]:::input
    end

    %% Unfolding Module
    subgraph Unfolding["Unfolding Module"]
        UP["Upsampling Layer"]:::process
        DOWN["Downsampling Layer"]:::process
    end

    %% MARNet Core
    subgraph MARNet["MARNet Core"]
        MAB1["Multi-Head<br/>Attention Block 1"]:::attention
        MAB2["Multi-Head<br/>Attention Block 2"]:::attention
        RES["Residual Learning<br/>Paths"]:::residual
    end

    %% Post-processing Module
    subgraph PostProc["Post-processing Module"]
        SMAR["Secondary MARNet<br/>Architecture"]:::process
    end

    %% Output Layer
    OUT[("Fused High-Resolution<br/>Output")]:::output

    %% Connections
    PAN --> UP
    MS --> UP
    UP --> MAB1
    MAB1 --> MAB2
    MAB2 --> RES
    DOWN --> RES
    RES --> SMAR
    SMAR --> OUT

    %% Residual Connections
    PAN -.-> RES
    MS -.-> RES

    %% Click Events
    click MARNet "https://github.com/tami-uib/marnet/blob/main/MARnet.py"
    click MAB1 "https://github.com/tami-uib/marnet/blob/main/modules.py"
    click MAB2 "https://github.com/tami-uib/marnet/blob/main/modules.py"
    click UP "https://github.com/tami-uib/marnet/blob/main/modules.py"
    click DOWN "https://github.com/tami-uib/marnet/blob/main/modules.py"
    click SMAR "https://github.com/tami-uib/marnet/blob/main/modules.py"

    %% Styles
    classDef input fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef output fill:#a8d1ff,stroke:#333,stroke-width:2px
    classDef process fill:#d3d3d3,stroke:#333,stroke-width:2px
    classDef attention fill:#ffa500,stroke:#333,stroke-width:2px
    classDef residual fill:#dda0dd,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[("Input/Output")]:::input
        L2["Processing Module"]:::process
        L3["Attention Block"]:::attention
        L4["Residual Component"]:::residual
        L5[" "] --- L6[" "] --> L7["Data Flow"]
        L8[" "] -.-> L9["Residual Connection"]
    end
```
