Skip to content

[OpenCV DNN - Feature request] Subpixel convolution layer support #11183

Closed

Description

@ishmael1985

Many state-of-the-art super-resolution algorithms (ESPCN, SRResNet / SRGAN) utilize subpixel convolution to improve performance instead of transposed convolution.

https://arxiv.org/abs/1609.05158
https://github.com/tetrachrome/subpixel

Is there any plan to implement this as a supported layer in OpenCV DNN? I only see OpenCV DNN supports deconvolution.

Activity

  1. dkurt commented on Jun 26, 2018

    @dkurt
    Member

    @ishmael1985, Am I right that subpixel convolution is just a series of regular convolutions ended by a simple tensor transformation which can be implemented using Reshape+Transpose+Reshape operations?

    screenshot from 2018-06-26 07-58-26

    import numpy as np
    
    r = 3
    h = 5
    w = 5
    
    src = np.zeros([r*r, h, w])
    for i in range(src.shape[0]):
        src[i] = i
    
    src = src.reshape(r, r, h, w)
    src = src.transpose(2, 0, 3, 1)
    src = src.reshape(1, h*r, w*r)
    print src
  2. JVision commented on Dec 5, 2018

    @JVision

    @dkurt yes, your understanding is correct.

  3. cyberbeat commented on Nov 24, 2019

    @cyberbeat

    I have a similar error with torch import:

    OpenCV(4.1.2-pre) Error: Unspecified error (Can't create layer "l125_PixelShuffle" of type "PixelShuffle") in getLayerInstance, file opencv/modules/dnn/src/dnn.cpp, line 525
    terminate called after throwing an instance of 'cv::Exception'
    what(): OpenCV(4.1.2-pre) opencv/modules/dnn/src/dnn.cpp:525: error: (-2:Unspecified error) Can't create layer "l125_PixelShuffle" of type "PixelShuffle" in function 'getLayerInstance'

    See here: https://github.com/torch/nn/blob/master/PixelShuffle.lua

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions