BlurPool#
- class composer.algorithms.BlurPool(replace_convs=True, replace_maxpools=True, blur_first=True, min_channels=16)[source]#
BlurPool adds anti-aliasing filters to convolutional layers.
This algorithm increases accuracy and invariance to small shifts in the input. It runs on
Event.INIT
.- Parameters
replace_convs (bool) โ replace strided
torch.nn.Conv2d
modules withBlurConv2d
modules. Default:True
.replace_maxpools (bool) โ replace eligible
torch.nn.MaxPool2d
modules withBlurMaxPool2d
modules. Default:True
.blur_first (bool) โ when
replace_convs
isTrue
, blur input before the associated convolution. When set toFalse
, the convolution is applied with a stride of 1 before the blurring, resulting in significant overhead (though more closely matching the paper). SeeBlurConv2d
for further discussion. Default:True
.min_channels (int, optional) โ Skip replacing layers with in_channels < min_channels. Commonly used to prevent the blurring of the first layer. Default: 16.