-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[Feature Request / Proposal] Pixel shuffle layer #13548
Comments
Hi @kohr-h please feel free to raise a PR to contribute to this operator/example in Python. |
If it can be achieved simply using combination of |
True, it's just reshaping in the end, although not entirely trivial to make work as hybrid block. Regarding placement, |
Nice I was just looking for this |
Hmm but somehow I'll get strange result I replaced all my Conv2DTranspose layers with a Conv2D(channels= 2 * 2 * num_channel(*)) and then PixelShuffle2D((2,2)) (*) num_channels = equal the number of channels that used to be in Conv2DTranspose |
Possible, I have to do more testing myself. I think you need to swap axes before reshaping. |
Btw you might want to have look at the example/gluon/Superpixel it looks to me there someone wrote already a PixelShuffle OP in there. I have not tried it yet to see if it works correctly though. |
@Mut1nyJD I've updated the code in the PR and cross-checked it against the PyTorch implementation. |
Thanks for the pointer. Indeed, that's the same operation. It would make sense to drop in the new layer there. |
* Add pixelshuffle layers, closes #13548 * Remove fmt comments * Use explicit class in super() * Add axis swapping to pixel shuffling, add tests * Add documentation to pixel shuffle layers * Use pixelshuffle layer and fix download in superres example * Add pixelshuffle layers to API doc page
* Add pixelshuffle layers, closes apache#13548 * Remove fmt comments * Use explicit class in super() * Add axis swapping to pixel shuffling, add tests * Add documentation to pixel shuffle layers * Use pixelshuffle layer and fix download in superres example * Add pixelshuffle layers to API doc page
* Add pixelshuffle layers, closes apache#13548 * Remove fmt comments * Use explicit class in super() * Add axis swapping to pixel shuffling, add tests * Add documentation to pixel shuffle layers * Use pixelshuffle layer and fix download in superres example * Add pixelshuffle layers to API doc page
* Add pixelshuffle layers, closes apache#13548 * Remove fmt comments * Use explicit class in super() * Add axis swapping to pixel shuffling, add tests * Add documentation to pixel shuffle layers * Use pixelshuffle layer and fix download in superres example * Add pixelshuffle layers to API doc page
* Add pixelshuffle layers, closes apache#13548 * Remove fmt comments * Use explicit class in super() * Add axis swapping to pixel shuffling, add tests * Add documentation to pixel shuffle layers * Use pixelshuffle layer and fix download in superres example * Add pixelshuffle layers to API doc page
* Add pixelshuffle layers, closes apache#13548 * Remove fmt comments * Use explicit class in super() * Add axis swapping to pixel shuffling, add tests * Add documentation to pixel shuffle layers * Use pixelshuffle layer and fix download in superres example * Add pixelshuffle layers to API doc page
Upsampling based on pixel shuffling has been proposed in the paper Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network (2016). The complete method combines a convolution layer, the pixel shuffle operation and a specific initialization to get rid of block artifacts. For the initialization details, see Checkerboard artifact free sub-pixel convolution: A note on sub-pixel convolution, resize convolution and convolution resize (2017).
Pixel shuffling in 2D means to reshape a tensor of shape
(N, f1*f2*C, H, W)
to(N, C, f1*H, f2*W)
, thereby effectively upscaling the images by(f1, f2)
.In MXNet, pixel shuffling could be implemented like this in Python:
Would this be an interesting addition?
The text was updated successfully, but these errors were encountered: