mmagic.models.editors.duf
¶
Package Contents¶
Classes¶
Dynamic upsampling filter used in DUF. |
- class mmagic.models.editors.duf.DynamicUpsamplingFilter(filter_size=(5, 5))[source]¶
Bases:
mmengine.model.BaseModule
Dynamic upsampling filter used in DUF.
Ref: https://github.com/yhjo09/VSR-DUF. It only supports input with 3 channels. And it applies the same filters to 3 channels.
- Parameters
filter_size (tuple) – Filter size of generated filters. The shape is (kh, kw). Default: (5, 5).
- forward(x, filters)[source]¶
Forward function for DynamicUpsamplingFilter.
- Parameters
x (Tensor) – Input image with 3 channels. The shape is (n, 3, h, w).
filters (Tensor) –
Generated dynamic filters. The shape is (n, filter_prod, upsampling_square, h, w). filter_prod: prod of filter kernel size, e.g., 1*5*5=25. upsampling_square: similar to pixel shuffle,
upsampling_square = upsampling * upsampling e.g., for x 4 upsampling, upsampling_square= 4*4 = 16
- Returns
Filtered image with shape (n, 3*upsampling, h, w)
- Return type
Tensor