The implementation of Learning-based Padding: From Connectivity on Data Borders to Data Padding.
- You can find LPC/LPA module in learning_padding.py
- python 3.8
- pytorch 1.7.1 (>=1.2.0)
If you want to pad a C channels feature map M with S stride.
from learning_padding import LearningPaddingByConvolution, LearningPaddingByAttention
LPC_map = LearningPaddingByConvolution(in_channels=C, stride=S)
LPA_map = LearningPaddingByAttention(in_channels=C, stride=S)
- import upgrade.py file.
from upgrade import Upgrade
-
Prepare your network and load the checkpoint.
-
Upgrade your network. You have to choose the padding type, 'LPC' or 'LPA'.
upgrade = Upgrade(net, 'LPA')
new_net = upgrade.new_net
The part of checkpoints of paper can be found in Google Drive. The all checkpoints of paper can be found in Baidu Drive.
@article{NING2023106048,
title = {Learning-based padding: From connectivity on data borders to data padding},
journal = {Engineering Applications of Artificial Intelligence},
volume = {121},
pages = {106048},
year = {2023},
issn = {0952-1976},
author = {Chao Ning and Hongping Gan and Minghe Shen and Tao Zhang},
}
This repo benefits from awesome works of CIFAR100, timm DeepLabV3, ConvNeXt.