EPSANet:An Efficient Pyramid Split Attention Block on Convolutional Neural Network

Overview

EPSANet:An Efficient Pyramid Split Attention Block on Convolutional Neural Network

This repo contains the official Pytorch implementaion code and configuration files of EPSANet:An Efficient Pyramid Split Attention Block on Convolutional Neural Network. created by Hu Zhang.

Installation

Requirements

  • Python 3.6+
  • PyTorch 1.0+

Our environments

  • OS: Ubuntu 18.04
  • CUDA: 10.0
  • Toolkit: PyTorch 1.0
  • GPU: Titan RTX

Data preparation

Download and extract ImageNet train and val images from http://image-net.org/. The directory structure is the standard layout for the torchvision datasets.ImageFolder, and the training and validation data is expected to be in the train/ folder and val folder respectively:

/path/to/imagenet/
  train/
    class1/
      img1.jpeg
    class2/
      img2.jpeg
  val/
    class1/
      img3.jpeg
    class/2
      img4.jpeg

Usage

First, clone the repository locally:

git clone https://github.com/murufeng/EPSANet.git
cd EPSANet
  • Create a conda virtual environment and activate it:
conda create -n epsanet python=3.6 
conda activate epsanet
conda install -c pytorch pytorch torchvision

Training

To train models on ImageNet with 8 gpus run:

CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python main.py -a epsanet50 --data /path/to/imagenet 

Model Zoo

Models are trained with 8 GPUs on both ImageNet and MS-COCO 2017 dataset.

Image Classification on ImageNet

Model Params(M) FLOPs(G) Top-1 (%) Top-5 (%)
EPSANet-50(Small) 22.56 3.62 77.49 93.54
EPSANet-50(Large) 27.90 4.72 78.64 94.18
EPSANet-101(Small) 38.90 6.82 78.43 94.11
EPSANet-101(Large) 49.59 8.97 79.38 94.58

Object Detection on MS-COCO 2017

Faster R-CNN

model Style Lr schd Params(M) FLOPs(G) box AP AP_50 AP_75
EPSANet-50(small) pytorch 1x 38.56 197.07 39.2 60.3 42.3
EPSANet-50(large) pytorch 1x 43.85 219.64 40.9 62.1 44.6

Mask R-CNN

model Style Lr schd Params(M) FLOPs(G) box AP AP_50 AP_75
EPSANet-50(small) pytorch 1x 41.20 248.53 40.0 60.9 43.3
EPSANet-50(large) pytorch 1x 46.50 271.10 41.4 62.3 45.3

RetinaNet

model Style Lr schd Params(M) FLOPs(G) box AP AP_50 AP_75
EPSANet-50(small) pytorch 1x 34.78 229.32 38.2 58.1 40.6
EPSANet-50(large) pytorch 1x 40.07 251.89 39.6 59.4 42.3

Instance segmentation with Mask R-CNN on MS-COCO 2017

model Params(M) FLOPs(G) AP AP_50 AP_75
EPSANet-50(small) 41.20 248.53 35.9 57.7 38.1
EPSANet-50(Large) 46.50 271.10 37.1 59.0 39.5

Citing EPSANet

You can cite the paper as:

@article{hu2021epsanet,
  title={EPSANet:An Efficient Pyramid Split Attention Block on Convolutional Neural Network},
  author={Hu Zhang and Keke Zu and Jian Lu and Yuru Zou and Deyu Meng},
  journal={arXiv preprint arXiv:2105.14447},
  year={2021}
}
You might also like...
 a reimplementation of Optical Flow Estimation using a Spatial Pyramid Network in PyTorch
a reimplementation of Optical Flow Estimation using a Spatial Pyramid Network in PyTorch

pytorch-spynet This is a personal reimplementation of SPyNet [1] using PyTorch. Should you be making use of this work, please cite the paper according

The code repository for "RCNet: Reverse Feature Pyramid and Cross-scale Shift Network for Object Detection" (ACM MM'21)

RCNet: Reverse Feature Pyramid and Cross-scale Shift Network for Object Detection (ACM MM'21) By Zhuofan Zong, Qianggang Cao, Biao Leng Introduction F

Cascaded Pyramid Network (CPN) based on Keras (Tensorflow backend)
Cascaded Pyramid Network (CPN) based on Keras (Tensorflow backend)

ML2 Takehome Project Reimplementing the paper: Cascaded Pyramid Network for Multi-Person Pose Estimation Dataset The model uses the COCO dataset which

Pytorch reimplementation of PSM-Net:
Pytorch reimplementation of PSM-Net: "Pyramid Stereo Matching Network"

This is a Pytorch Lightning version PSMNet which is based on JiaRenChang/PSMNet. use python main.py to start training. PSM-Net Pytorch reimplementatio

Pytorch implementation of Feature Pyramid Network (FPN) for Object Detection

fpn.pytorch Pytorch implementation of Feature Pyramid Network (FPN) for Object Detection Introduction This project inherits the property of our pytorc

Pyramid Grafting Network for One-Stage High Resolution Saliency Detection. CVPR 2022
Pyramid Grafting Network for One-Stage High Resolution Saliency Detection. CVPR 2022

PGNet Pyramid Grafting Network for One-Stage High Resolution Saliency Detection. CVPR 2022, CVPR 2022 (arXiv 2204.05041) Abstract Recent salient objec

BossNAS: Exploring Hybrid CNN-transformers with Block-wisely Self-supervised Neural Architecture Search
BossNAS: Exploring Hybrid CNN-transformers with Block-wisely Self-supervised Neural Architecture Search

BossNAS This repository contains PyTorch evaluation code, retraining code and pretrained models of our paper: BossNAS: Exploring Hybrid CNN-transforme

Block-wisely Supervised Neural Architecture Search with Knowledge Distillation (CVPR 2020)
Block-wisely Supervised Neural Architecture Search with Knowledge Distillation (CVPR 2020)

DNA This repository provides the code of our paper: Blockwisely Supervised Neural Architecture Search with Knowledge Distillation. Illustration of DNA

PyTorch code for our paper "Attention in Attention Network for Image Super-Resolution"

Under construction... Attention in Attention Network for Image Super-Resolution (A2N) This repository is an PyTorch implementation of the paper "Atten

Comments
  • 论文中的SeWeight的含义?

    论文中的SeWeight的含义?

    你好 刚刚在公众号看到你们的论文,对于多尺度特征,可不可以理解为Fi单独送到SE?也就是说SE最后的sigmod在你这边是单独绘图的,前面的两层conv与relu是你论文中所述的SEWeight?

    self.SEWeight = nn.Sequential(
                nn.Conv2d(channel, channel // reduction, 1, padding=0, bias=True),
                nn.ReLU(inplace=True),
                nn.Conv2d(channel // reduction, channel, 1, padding=0, bias=True),
                #nn.Sigmoid()
            )
    
    opened by Senwang98 2
  • Some doubts about paper and code 论文和代码的一些疑惑

    Some doubts about paper and code 论文和代码的一些疑惑

    I read the EPSAnet paper and code, but found some differences. In the paper, it is proposed to divide the channels of the feature map into S groups, and then convolve the S groups separately. The number of convolutional channels remains unchanged. The groups are all C/S, but I think that in the code, all input channels are convolved, and the number of output channels of the convolution becomes C/S. May I ask, which one of the two should be followed? 拜读了EPSAnet的论文和代码,但是发现有些不一样的地方,在论文中提出将feature map的通道分成S组,然后对这S组再分别进行卷积,卷积出来的通道数不变,每组都是C/S,但是我看在代码上是对所有的输入通道都进行卷积,卷积的输出通道数变成了C/S,请问,这两个应该遵从哪一个呢?

    opened by frankxzq 1
  • using EPSA in resnet BasicBlock

    using EPSA in resnet BasicBlock

    Hi, thank you for your work. My network structure is resnet20, and its "BasicBlock" structure is as follows: image Now I want to try EPSA, how do I build the network structure? Looking forward to your answer, thank you.

    opened by Danee-wawawa 0
This is a model made out of Neural Network specifically a Convolutional Neural Network model

This is a model made out of Neural Network specifically a Convolutional Neural Network model. This was done with a pre-built dataset from the tensorflow and keras packages. There are other alternative libraries that can be used for this purpose, one of which is the PyTorch library.

null 9 Oct 18, 2022
Code for the ICCV 2021 Workshop paper: A Unified Efficient Pyramid Transformer for Semantic Segmentation.

Unified-EPT Code for the ICCV 2021 Workshop paper: A Unified Efficient Pyramid Transformer for Semantic Segmentation. Installation Linux, CUDA>=10.0,

null 29 Aug 23, 2022
Implementation of the 😇 Attention layer from the paper, Scaling Local Self-Attention For Parameter Efficient Visual Backbones

HaloNet - Pytorch Implementation of the Attention layer from the paper, Scaling Local Self-Attention For Parameter Efficient Visual Backbones. This re

Phil Wang 189 Nov 22, 2022
Implementation of a memory efficient multi-head attention as proposed in the paper, "Self-attention Does Not Need O(n²) Memory"

Memory Efficient Attention Pytorch Implementation of a memory efficient multi-head attention as proposed in the paper, Self-attention Does Not Need O(

Phil Wang 180 Jan 5, 2023
PyTorch Implementation of [1611.06440] Pruning Convolutional Neural Networks for Resource Efficient Inference

PyTorch implementation of [1611.06440 Pruning Convolutional Neural Networks for Resource Efficient Inference] This demonstrates pruning a VGG16 based

Jacob Gildenblat 836 Dec 26, 2022
Code for our ICASSP 2021 paper: SA-Net: Shuffle Attention for Deep Convolutional Neural Networks

SA-Net: Shuffle Attention for Deep Convolutional Neural Networks (paper) By Qing-Long Zhang and Yu-Bin Yang [State Key Laboratory for Novel Software T

Qing-Long Zhang 199 Jan 8, 2023
(IEEE TIP 2021) Regularized Densely-connected Pyramid Network for Salient Instance Segmentation

RDPNet IEEE TIP 2021: Regularized Densely-connected Pyramid Network for Salient Instance Segmentation PyTorch training and testing code are available.

Yu-Huan Wu 41 Oct 21, 2022
EDPN: Enhanced Deep Pyramid Network for Blurry Image Restoration

EDPN: Enhanced Deep Pyramid Network for Blurry Image Restoration Ruikang Xu, Zeyu Xiao, Jie Huang, Yueyi Zhang, Zhiwei Xiong. EDPN: Enhanced Deep Pyra

null 69 Dec 15, 2022
Adaptive Pyramid Context Network for Semantic Segmentation (APCNet CVPR'2019)

Adaptive Pyramid Context Network for Semantic Segmentation (APCNet CVPR'2019) Introduction Official implementation of Adaptive Pyramid Context Network

null 21 Nov 9, 2022
[ICCV 2021] FaPN: Feature-aligned Pyramid Network for Dense Image Prediction

FaPN: Feature-aligned Pyramid Network for Dense Image Prediction [arXiv] [Project Page] @inproceedings{ huang2021fapn, title={{FaPN}: Feature-alig

Shihua Huang 23 Jul 22, 2022