Skip to content

Conversation

@Akalpisa
Copy link

Add SRGAN and RDN Models to dnn_superres Module

This PR adds two new super-resolution models to OpenCV's dnn_superres module:

  1. SRGAN (Super-Resolution Generative Adversarial Network): A GAN-based model for more realistic and detailed super-resolution results (x4 scaling).
  2. RDN (Residual Dense Network): A high-performance super-resolution model utilizing densely connected residual blocks (x3 scaling).

Changes

  • dnn_superres.hpp: Added new model types and documentation to the API
  • dnn_superres.cpp: Added processing support for SRGAN and RDN models in the upsample function
  • README.md: Added information, academic references, and documentation for the new models
  • test_dnn_superres.cpp: Added new tests for SRGAN and RDN models
  • test_dnn_superres.py: Added tests for the Python API
  • dnn_superres_srgan_rdn_demo.cpp: Added a sample application demonstrating the new models
  • CMakeLists.txt: Added the new sample application to the build

Test Results

  • API integration tests have been successfully completed
  • The code is written according to OpenCV's existing style guidelines
  • Copyright notices and appropriate documentation have been added

Model Files

This PR includes only code changes, not model files. During testing and development, existing OpenCV model files were used to verify API integration.

Trained model files for SRGAN and RDN can be obtained from these sources:

Academic References

  • SRGAN: Ledig, Christian, et al. "Photo-realistic single image super-resolution using a generative adversarial network." CVPR 2017.
  • RDN: Zhang, Yulun, et al. "Residual dense network for image super-resolution." CVPR 2018.

Patent Review

The added models are derived from academic papers and, to our knowledge, have no patent restrictions.

Update dnn_superres.hpp to include new SRGAN and RDN models in API documentation and constants
Implement processing logic for SRGAN and RDN super-resolution models
Add documentation, references and citation information for new models
New sample application demonstrating the use of SRGAN and RDN models
Add comprehensive test functions for SRGAN and RDN models:
- Add basic model loading and API tests
- Add SRGAN_x4 model tests
- Add RDN_x3 model tests
- Add parameter validation tests
- Add different input size and channel tests
- Enhance test coverage for the new models
Extend Python API tests to include SRGAN and RDN models:
- Add test_srgan() function for SRGAN_x4 model testing
- Add test_rdn() function for RDN_x3 model testing
- Verify model loading, scale setting, and upsampling
- Test input/output dimensions and model properties
- Complete test coverage for Python API integration
Add build configuration for models demo application
- Fixed header guard structure (#ifndef, #define, #endif)
- Corrected comment formatting in constructor documentation
- Cleaned up class member organization and spacing
- Ensured proper namespace closure
@Akalpisa Akalpisa closed this Mar 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant