The paper proposed a patch aggregation method, find it.
Assistant
The provided files do not contain explicit information about a "patch aggregation method". However, they do contain code for PatchMerging which could be related to patch aggregation.
The PatchMerging class in ldm/modules/swinir.py and basicsr/archs/swinir_arch.py implements a method to merge patches of an image. This is done by concatenating the features of 2x2 patches, reducing the spatial resolution and doubling the number of channels.
Here's how it works:
Input: The input x is a tensor of shape (B, H*W, C), where B is the batch size, H is the height, W is the width and is the number of channels. This represents the flattened feature map of an image.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Reshape: The tensor x is reshaped to (B, H, W, C).
Patch Extraction: The code extracts four patches from the reshaped tensor:
x0: Top-left patch (every other pixel from both height and width dimensions)
x1: Top-right patch (every other pixel from height dimension and odd pixels from width)
x2: Bottom-left patch (odd pixels from the height dimension, and every other pixel from width dimension)
x3: Bottom-right patch (odd pixels from both height and width)
Concatenation: The four patches are concatenated along the channel dimension, resulting in a tensor of shape (B, H/2, W/2, 4*C).
Reshape and Reduction: The tensor is reshaped to (B, H/2*W/2, 4*C). A linear layer, self.reduction, is applied to reduce the number of channels from 4*C to 2*C.
In summary, while the term "patch aggregation" isn't used directly, the PatchMerging layer effectively aggregates information from neighboring patches. The spatial resolution is reduced (H, W) to (H/2, W/2) while increasing the channel dimension (C) to (2C) .