Skip to content

Added fully functional convTranspose layer to new DNN engine #27560

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: 5.x
Choose a base branch
from

Conversation

abhishek-gola
Copy link
Contributor

@abhishek-gola abhishek-gola commented Jul 19, 2025

Closes #26307

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
  • The PR is proposed to the proper branch
  • There is a reference to the original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake

@abhishek-gola abhishek-gola marked this pull request as draft July 19, 2025 16:21
@abhishek-gola abhishek-gola marked this pull request as ready for review July 20, 2025 11:07
@abhishek-gola abhishek-gola requested a review from asmorkalov July 21, 2025 07:37
@asmorkalov
Copy link
Contributor

Build issue with CUDA and CuDNN:

[ 72%] Building CXX object modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/dequantizelinear_layer.cpp.o
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp: In member function ‘virtual cv::Ptr<cv::dnn::dnn5_v20241127::BackendNode> cv::dnn::DeConvolutionLayerImpl::initCUDA(void*, const std::vector<cv::Ptr<cv::dnn::dnn5_v20241127::BackendWrapper> >&, const std::vector<cv::Ptr<cv::dnn::dnn5_v20241127::BackendWrapper> >&)’:
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2121:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘fusion_mode’
 2121 |         config.fusion_mode = cudaFusionMode;
      |                ^~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2121:30: error: ‘cudaFusionMode’ was not declared in this scope
 2121 |         config.fusion_mode = cudaFusionMode;
      |                              ^~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2122:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘activation_type’
 2122 |         config.activation_type = cudaActType;
      |                ^~~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2122:34: error: ‘cudaActType’ was not declared in this scope; did you mean ‘cudaDataType’?
 2122 |         config.activation_type = cudaActType;
      |                                  ^~~~~~~~~~~
      |                                  cudaDataType
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2123:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘relu_negative_slope’
 2123 |         config.relu_negative_slope = cuda_relu_slope;
      |                ^~~~~~~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2123:38: error: ‘cuda_relu_slope’ was not declared in this scope
 2123 |         config.relu_negative_slope = cuda_relu_slope;
      |                                      ^~~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2124:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘crelu_floor’
 2124 |         config.crelu_floor = cuda_crelu_floor;
      |                ^~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2124:30: error: ‘cuda_crelu_floor’ was not declared in this scope
 2124 |         config.crelu_floor = cuda_crelu_floor;
      |                              ^~~~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2125:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘crelu_ceil’
 2125 |         config.crelu_ceil = cuda_crelu_ceil;
      |                ^~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2125:29: error: ‘cuda_crelu_ceil’ was not declared in this scope
 2125 |         config.crelu_ceil = cuda_crelu_ceil;
      |                             ^~~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2126:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘power_exp’
 2126 |         config.power_exp = cuda_power_exp;
      |                ^~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2126:28: error: ‘cuda_power_exp’ was not declared in this scope
 2126 |         config.power_exp = cuda_power_exp;
      |                            ^~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2127:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘power_scale’
 2127 |         config.power_scale = cuda_power_scale;
      |                ^~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2127:30: error: ‘cuda_power_scale’ was not declared in this scope
 2127 |         config.power_scale = cuda_power_scale;
      |                              ^~~~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2128:16: error: ‘struct cv::dnn::cuda4dnn::TransposeConvolutionConfiguration’ has no member named ‘power_shift’
 2128 |         config.power_shift = cuda_power_shift;
      |                ^~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2128:30: error: ‘cuda_power_shift’ was not declared in this scope
 2128 |         config.power_shift = cuda_power_shift;
      |                              ^~~~~~~~~~~~~~~~
/mnt/Projects/Projects/opencv-next/modules/dnn/src/layers/convolution_layer.cpp:2131:86: error: ‘biasvec’ was not declared in this scope
 2131 |         Mat biasMat = (hasBias() || fusedBias) ? Mat(output_feature_maps, 1, CV_32F, biasvec.data()) : Mat();
      |                                                                                      ^~~~~~~
make[3]: *** [modules/dnn/CMakeFiles/opencv_dnn.dir/build.make:952: modules/dnn/CMakeFiles/opencv_dnn.dir/src/layers/convolution_layer.cpp.o] Error 1

Setup details:

  NVIDIA CUDA:                   YES (ver 12.6, CUFFT CUBLAS NVCUVID NVCUVENC)
    NVIDIA GPU arch:             61
    NVIDIA PTX archs:

  cuDNN:                         YES (ver 9.10.1)

@abhishek-gola abhishek-gola marked this pull request as draft July 21, 2025 12:10
@abhishek-gola abhishek-gola force-pushed the convTranspose_layer_add branch from b4ed47d to 05878b5 Compare July 22, 2025 09:56
@abhishek-gola abhishek-gola marked this pull request as ready for review July 22, 2025 13:43
@asmorkalov
Copy link
Contributor

DNN Classic CUDA test failed with sigsegv

@asmorkalov
Copy link
Contributor

@abhishek-gola Please rebase the PR and fix conflicts.

@abhishek-gola abhishek-gola force-pushed the convTranspose_layer_add branch from 70c3a35 to 160a918 Compare July 30, 2025 07:50
@asmorkalov
Copy link
Contributor

@abhishek-gola Please rebase and fix conflicts.

@asmorkalov
Copy link
Contributor

@vpisarev What are the next steps here?

@abhishek-gola abhishek-gola force-pushed the convTranspose_layer_add branch from 160a918 to 8bc18f8 Compare August 11, 2025 06:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants