MCPcopy
hub / github.com/xmu-xiaoma666/External-Attention-pytorch

github.com/xmu-xiaoma666/External-Attention-pytorch @main sqlite

repository ↗ · DeepWiki ↗
1,442 symbols 3,017 edges 86 files 247 documented · 17%
README

English | 简体中文

FightingCV Codebase For Attention,Backbone, MLP, Re-parameter, Convolution


🔥🔥🔥As a supplement to the project, a object detection codebase YOLOAir has recently been newly opened, which integrates various attention mechanisms in the object detection algorithm. The code is simple and easy to read. Welcome to play and star🌟!**


Hello, everyone, I'm Xiaoma 🚀🚀🚀

For beginners (like me): Recently, I found a problem when reading the paper. Sometimes the core idea of the paper is very simple, and the core code may be just a dozen lines. However, when I open the source code of the author's release, I find that the proposed module is embedded in the task framework such as classification, detection and segmentation, resulting in redundant code. For me who is not familiar with the specific task framework, it is difficult to find the core code, resulting in some difficulties in understanding the paper and network ideas.

For advanced (like you): If the basic units conv, FC and RNN are regarded as small Lego blocks, and the structures transformer and RESNET are regarded as LEGO castles that have been built. The modules provided by this project are LEGO components with complete semantic informationLet scientific researchers avoid repeatedly building wheels, just think about how to use these "LEGO components" to build more colorful works.

For proficient (may be like you): Limited capacity, do not like light spraying!!!

For All: This project aims to realize a code base that can make beginners of deep learning understand and serve scientific research and industrial communities. As fightingcv wechat official accountThe purpose of this project is to achieve 🚀Let there be no hard to read papers in the world🚀。 (at the same time, we also welcome all scientific researchers to sort out the core code of their work into this project, promote the development of the scientific research community, and indicate the author of the code in readme ~)


Contents


Attention Series


1. External Attention Usage

1.1. Paper

"Beyond Self-attention: External Attention using Two Linear Layers for Visual Tasks"

1.2. Overview

1.3. Usage Code

from model.attention.ExternalAttention import ExternalAttention
import torch

input=torch.randn(50,49,512)
ea = ExternalAttention(d_model=512,S=8)
output=ea(input)
print(output.shape)

2. Self Attention Usage

2.1. Paper

"Attention Is All You Need"

1.2. Overview

1.3. Usage Code

```python from model.attention.SelfAttention import S

Core symbols most depended-on inside this repo

trunc_normal_
called by 70
model/backbone/ConTNet.py
_cfg
called by 47
model/backbone/CMT.py
_cfg
called by 22
model/backbone/MobileNetV3.py
_cfg
called by 15
model/backbone/swin_transformer_v2_cr.py
_create_swin_transformer_v2_cr
called by 15
model/backbone/swin_transformer_v2_cr.py
_gen_mobilenet_v3
called by 13
model/backbone/MobileNetV3.py
_cfg
called by 13
model/backbone/swin_transformer.py
_create_swin_transformer
called by 13
model/backbone/swin_transformer.py

Shape

Method 850
Class 306
Function 286

Languages

Python100%

Modules by API surface

model/backbone/swin_transformer_v2_cr.py60 symbols
model/backbone/VOLO.py47 symbols
model/backbone/CPVT.py47 symbols
model/attention/Axial_attention.py45 symbols
model/backbone/swin_transformer_v2.py43 symbols
model/backbone/swin_transformer.py42 symbols
model/backbone/CoaT.py42 symbols
model/attention/MOATransformer.py42 symbols
model/backbone/MobileNetV3.py41 symbols
model/attention/Crossformer.py39 symbols
model/backbone/PatchConvnet.py38 symbols
model/backbone/EfficientFormer.py38 symbols

For agents

$ claude mcp add External-Attention-pytorch \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact