# aifengheshu/plug-play-modules architecture

> Architecture diagram of the GitHub repository aifengheshu/plug-play-modules, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aifengheshu/plug-play-modules
- Repository: https://github.com/aifengheshu/plug-play-modules

## Overview

##### Project type and purpose
- This is an open-source library (“Plug-play-modules”) that aggregates a large set of independent neural-network building blocks (attention modules, convolution variants, normalization layers, down/up samplers, backbones, activations, losses, etc.), each implemented in its own Python file or category folder.
- The README describes its goal: share “2025-year plug-and-play code modules” from top conferences (CVPR, ICCV, ICLR, arXiv, etc.) so that practitioners can easily import and swap in new research components without rewriting code.

##### File structure
- Top-level components:
- Individual .py files (e.g., AxialAttention.py, BAM.py, CondConv.py…)
- Category folders numbered 3–9:
3. Block (功能模块) – dozens of feature-fusion and token-mixer modules
4. Mamba – a subcollection of “ViM” and “SS-Conv-SSM” blocks
5. Normalization – e.g., BCNorm, RepBN, Crossnorm
6. Backbone – lightweight CNN/Transformer backbones
7. Down & Up – pooling or sampling modules
8. Activation – custom activation functions
9. Loss – custom loss functions
- There is a README.md at the root describing the overall library.
- No build scripts or deployment pipelines are present—this is purely a code-library repo.

##### README for additional insights
- The README list shows 16 example entries, each with paper title, code link, and a link to a blog explanation.
- All modules rely on PyTorch (implied by naming conventions and typical usage), but no explicit requirements.txt is included.

##### Detailed capture of architectural elements
- Inside each category boundary, show 3–4 representative module names (e.g., DynamicFilter.py, AGCRN.py in Block; RepBN.py in Normalization).
- That each .py file implements a torch.nn.Module subclass.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Plug-play-modules Library"
      direction TB
      README["README.md"]:::doc
      Standalone["Standalone Modules<br/>e.g., AxialAttention.py, BAM.py, CondConv.py"]:::group
      subgraph "Block (功能模块)"
        CFBlock["DynamicFilter.py"]:::package
        AGCRN["AGCRN.py"]:::package
        TokenMixer["TokenMerging.py"]:::package
      end
      subgraph "Mamba (曼巴)"
        ViM["ViMBlock.py"]:::package
        SSConvSSM["SSConvSSM.py"]:::package
      end
      subgraph "Normalization (归一化)"
        RepBN["RepBN.py"]:::package
        BCNorm["BCNorm.py"]:::package
      end
      subgraph "Backbone (骨干网络)"
        CNNBackbone["CNNBackbone.py"]:::package
        TransformerBackbone["TransformerBackbone.py"]:::package
      end
      subgraph "Down & Up (池化或上下采样)"
        Pooling["AdaptivePooling.py"]:::package
        Upsample["UpSample.py"]:::package
      end
      subgraph "Activation (激活函数)"
        CustomAct["SwishPlus.py"]:::package
        Mish["Mish.py"]:::package
      end
      subgraph "Loss (损失函数)"
        CustomLoss["FocalLoss.py"]:::package
        DiceLoss["DiceLoss.py"]:::package
      end
    end

    PyTorch(["PyTorch Framework"]):::dependency
    UserScript(["External Model & Training Script"]):::external

    UserScript -->|"imports modules"| Standalone
    UserScript -->|"imports package APIs"| CFBlock
    UserScript -->|"imports package APIs"| RepBN
    UserScript -->|"imports package APIs"| CNNBackbone
    UserScript -->|"imports package APIs"| Pooling
    UserScript -->|"imports package APIs"| CustomAct
    UserScript -->|"imports package APIs"| CustomLoss

    PyTorch -->|"base class: torch.nn.Module"| CFBlock
    PyTorch -->|"base class: torch.nn.Module"| ViM
    PyTorch -->|"base class: torch.nn.Module"| RepBN
    PyTorch -->|"base class: torch.nn.Module"| CNNBackbone
    PyTorch -->|"base class: torch.nn.Module"| Pooling
    PyTorch -->|"base class: torch.nn.Module"| CustomAct
    PyTorch -->|"base class: torch.nn.Module"| CustomLoss
    PyTorch -->|"runtime engine"| Standalone

    click README "https://github.com/aifengheshu/plug-play-modules/blob/main/README.md"
    click Standalone "https://github.com/aifengheshu/plug-play-modules/tree/main/./"
    click CFBlock "https://github.com/aifengheshu/plug-play-modules/tree/main/./3. Block（功能模块）/"
    click AGCRN "https://github.com/aifengheshu/plug-play-modules/tree/main/./3. Block（功能模块）/"
    click TokenMixer "https://github.com/aifengheshu/plug-play-modules/tree/main/./3. Block（功能模块）/"
    click ViM "https://github.com/aifengheshu/plug-play-modules/tree/main/./4. Mamba（曼巴）/"
    click SSConvSSM "https://github.com/aifengheshu/plug-play-modules/tree/main/./4. Mamba（曼巴）/"
    click RepBN "https://github.com/aifengheshu/plug-play-modules/tree/main/./5. Normalization（归一化）/"
    click BCNorm "https://github.com/aifengheshu/plug-play-modules/tree/main/./5. Normalization（归一化）/"
    click CNNBackbone "https://github.com/aifengheshu/plug-play-modules/tree/main/./6. Backbone（骨干网络）/"
    click TransformerBackbone "https://github.com/aifengheshu/plug-play-modules/tree/main/./6. Backbone（骨干网络）/"
    click Pooling "https://github.com/aifengheshu/plug-play-modules/tree/main/./7. Down & Up（池化或上下采样）/"
    click Upsample "https://github.com/aifengheshu/plug-play-modules/tree/main/./7. Down & Up（池化或上下采样）/"
    click CustomAct "https://github.com/aifengheshu/plug-play-modules/tree/main/./8. Activation（激活函数）/"
    click Mish "https://github.com/aifengheshu/plug-play-modules/tree/main/./8. Activation（激活函数）/"
    click CustomLoss "https://github.com/aifengheshu/plug-play-modules/tree/main/./9. Loss（损失函数）/"
    click DiceLoss "https://github.com/aifengheshu/plug-play-modules/tree/main/./9. Loss（损失函数）/"

    classDef package fill:#bbf,stroke:#333,stroke-width:1px
    classDef group fill:#bfb,stroke:#333,stroke-width:1px
    classDef external fill:#ff9,stroke:#333,stroke-width:1px,stroke-dasharray:5 5
    classDef dependency fill:#9cf,stroke:#333,stroke-width:1px
    classDef doc fill:#fcf,stroke:#333,stroke-width:1px
```
