diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05b4fc3..5b57654 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=/tmp/install \ -DINSTALL_BIN_DESTINATION=. -DINSTALL_INCLUDE_DESTINATION=include \ -DINSTALL_LIB_DESTINATION=. -DINSTALL_MODEL_DESTINATION=. - cmake --build /tmp/build --config Debug --target install --parallel + cmake --build /tmp/build --config Debug --target install - name: Upload artifacts uses: actions/upload-artifact@v4 diff --git a/.gitmodules b/.gitmodules index ad06135..afedcde 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "third_party/librealesrgan_ncnn_vulkan"] - path = third_party/librealesrgan_ncnn_vulkan - url = https://github.com/k4yt3x/librealesrgan-ncnn-vulkan.git [submodule "third_party/ncnn"] path = third_party/ncnn url = https://github.com/Tencent/ncnn.git @@ -10,6 +7,12 @@ [submodule "third_party/boost"] path = third_party/boost url = https://github.com/boostorg/boost.git +[submodule "third_party/librealesrgan_ncnn_vulkan"] + path = third_party/librealesrgan_ncnn_vulkan + url = https://github.com/k4yt3x/librealesrgan-ncnn-vulkan.git +[submodule "third_party/librealcugan_ncnn_vulkan"] + path = third_party/librealcugan_ncnn_vulkan + url = https://github.com/k4yt3x/librealcugan-ncnn-vulkan.git [submodule "third_party/librife_ncnn_vulkan"] path = third_party/librife_ncnn_vulkan url = https://github.com/k4yt3x/librife-ncnn-vulkan.git diff --git a/CHANGELOG.md b/CHANGELOG.md index b697c3e..2470a9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Support for Real-CUGAN ncnn Vulkan (#1198). + ### Changed - Improve optimization flags and add namespaces for better code organization. diff --git a/CMakeLists.txt b/CMakeLists.txt index 1440ec9..1abc2ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,7 +260,20 @@ ExternalProject_Add( INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE} ) -# Add librealesrgan-ncnn-vulkan as an external project +# Add librealcugan-ncnn-vulkan as an external project +ExternalProject_Add( + realcugan + SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/librealcugan_ncnn_vulkan/src + CMAKE_ARGS + -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} + -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/realcugan_install + -DCMAKE_POSITION_INDEPENDENT_CODE=ON + -DUSE_SYSTEM_NCNN=${USE_SYSTEM_NCNN} + BUILD_ALWAYS ON + INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${CMAKE_BUILD_TYPE} +) + +# Add librife-ncnn-vulkan as an external project ExternalProject_Add( rife SOURCE_DIR ${PROJECT_SOURCE_DIR}/third_party/librife_ncnn_vulkan/src @@ -290,7 +303,7 @@ else() endif() # Ensure that the shared library is built after the external projects -add_dependencies(libvideo2x realesrgan rife) +add_dependencies(libvideo2x realesrgan realcugan rife) # Include directories for the shared library target_include_directories(libvideo2x PRIVATE @@ -299,6 +312,7 @@ target_include_directories(libvideo2x PRIVATE ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/include/libvideo2x ${PROJECT_SOURCE_DIR}/third_party/librealesrgan_ncnn_vulkan/src + ${PROJECT_SOURCE_DIR}/third_party/librealcugan_ncnn_vulkan/src ${PROJECT_SOURCE_DIR}/third_party/librife_ncnn_vulkan/src ) @@ -308,12 +322,14 @@ target_compile_options(libvideo2x PRIVATE -fPIC $<$:-g -DDEBUG>) # Define the paths to the shared libraries if(WIN32) set(REALESRGAN_LIB ${CMAKE_BINARY_DIR}/realesrgan_install/lib/librealesrgan-ncnn-vulkan.lib) + set(REALCUGAN_LIB ${CMAKE_BINARY_DIR}/realcugan_install/lib/librealcugan-ncnn-vulkan.lib) set(RIFE_LIB ${CMAKE_BINARY_DIR}/rife_install/lib/librife-ncnn-vulkan.lib) else() set(REALESRGAN_LIB ${CMAKE_BINARY_DIR}/realesrgan_install/lib/librealesrgan-ncnn-vulkan.so) + set(REALCUGAN_LIB ${CMAKE_BINARY_DIR}/realcugan_install/lib/librealcugan-ncnn-vulkan.so) set(RIFE_LIB ${CMAKE_BINARY_DIR}/rife_install/lib/librife-ncnn-vulkan.so) endif() -list(APPEND LIBVIDEO2X_LIBS ${REALESRGAN_LIB} ${RIFE_LIB}) +list(APPEND LIBVIDEO2X_LIBS ${REALESRGAN_LIB} ${REALCUGAN_LIB} ${RIFE_LIB}) # Link the shared library with the dependencies target_link_libraries(libvideo2x PRIVATE ${LIBVIDEO2X_LIBS}) @@ -403,6 +419,7 @@ if(WIN32) file(GLOB FFMPEG_DLLS "${FFMPEG_BASE_PATH}/bin/*.dll") install(FILES ${CMAKE_BINARY_DIR}/realesrgan_install/bin/librealesrgan-ncnn-vulkan.dll + ${CMAKE_BINARY_DIR}/realcugan_install/bin/librealcugan-ncnn-vulkan.dll ${CMAKE_BINARY_DIR}/rife_install/bin/librife-ncnn-vulkan.dll ${FFMPEG_DLLS} ${NCNN_BASE_PATH}/bin/ncnn.dll @@ -413,7 +430,7 @@ if(WIN32) WORLD_READ WORLD_EXECUTE ) else() - install(FILES ${REALESRGAN_LIB} ${RIFE_LIB} + install(FILES ${REALESRGAN_LIB} ${REALCUGAN_LIB} ${RIFE_LIB} DESTINATION ${INSTALL_LIB_DESTINATION} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE diff --git a/Makefile b/Makefile index 30f00a2..84a22e2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ .PHONY: build static debug windows windows-debug debian ubuntu clean \ - test-realesrgan test-libplacebo test-rife \ - memcheck-realesrgan memcheck-libplacebo memcheck-rife \ - heaptrack-realesrgan heaptrack-libplacebo heaptrack-rife + test-realesrgan test-realcugan test-libplacebo test-rife \ + memcheck-realesrgan memcheck-realcugan memcheck-libplacebo memcheck-rife \ + heaptrack-realesrgan heaptrack-realcugan heaptrack-libplacebo heaptrack-rife BINDIR=build CXX=clang++ @@ -130,6 +130,10 @@ test-realesrgan: LD_LIBRARY_PATH=$(BINDIR) $(BINDIR)/video2x -i $(TEST_VIDEO) -o $(TEST_OUTPUT) \ -p realesrgan -s 4 --realesrgan-model realesr-animevideov3 +test-realcugan: + LD_LIBRARY_PATH=$(BINDIR) $(BINDIR)/video2x -i $(TEST_VIDEO) -o $(TEST_OUTPUT) \ + -p realcugan -s 4 -n 0 --realcugan-model models-se + test-libplacebo: LD_LIBRARY_PATH=$(BINDIR) $(BINDIR)/video2x -i $(TEST_VIDEO) -o $(TEST_OUTPUT) \ -p libplacebo -w 1920 -h 1080 --libplacebo-shader anime4k-v4-a @@ -151,6 +155,19 @@ memcheck-realesrgan: -p realesrgan -s 2 --realesrgan-model realesr-animevideov3 \ -e preset=veryfast -e crf=30 +memcheck-realcugan: + LD_LIBRARY_PATH=$(BINDIR) valgrind \ + --tool=memcheck \ + --leak-check=full \ + --show-leak-kinds=all \ + --track-origins=yes \ + --show-reachable=yes \ + --verbose --log-file="valgrind.log" \ + $(BINDIR)/video2x \ + -i $(TEST_VIDEO) -o $(TEST_OUTPUT) \ + -p realcugan -s 2 -n 0 --realcugan-model models-se \ + -e preset=veryfast -e crf=30 + memcheck-libplacebo: LD_LIBRARY_PATH=$(BINDIR) valgrind \ --tool=memcheck \ @@ -184,6 +201,13 @@ heaptrack-realesrgan: -p realesrgan -s 4 --realesrgan-model realesr-animevideov3 \ -e preset=veryfast -e crf=30 +heaptrack-realcugan: + LD_LIBRARY_PATH=$(BINDIR) HEAPTRACK_ENABLE_DEBUGINFOD=1 heaptrack \ + $(BINDIR)/video2x \ + -i $(TEST_VIDEO) -o $(TEST_OUTPUT) \ + -p realcugan -s 4 -n 0 --realcugan-model models-se \ + -e preset=veryfast -e crf=30 + heaptrack-libplacebo: LD_LIBRARY_PATH=$(BINDIR) HEAPTRACK_ENABLE_DEBUGINFOD=1 heaptrack \ $(BINDIR)/video2x \ diff --git a/NOTICE b/NOTICE index 71b49c8..4ac85e2 100644 --- a/NOTICE +++ b/NOTICE @@ -10,6 +10,9 @@ The source code can be found at https://github.com/bloc97/Anime4K. This product depends on Real-ESRGAN ncnn Vulkan, which is available under the MIT License. The source code can be found at https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan. +This product depends on Real-CUGAN ncnn Vulkan, which is available under the MIT License. +The source code can be found at https://github.com/nihui/realcugan-ncnn-vulkan. + This product depends on RIFE ncnn Vulkan, which is available under the MIT License. The source code can be found at https://github.com/nihui/rife-ncnn-vulkan. diff --git a/README.md b/README.md index 93eb15f..71935d9 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,12 @@ Version 6.0.0 is a complete rewrite of this project in C/C++. It: - genuinely works this time, with much less hassle compared to the 5.0.0 beta; - is blazing fast, thanks to the new optimized pipeline and the efficiency of C/C++; - is cross-platform, available now for both Windows and Linux; -- offers significantly better output quality with Anime4K v4, RealESRGAN, and RIFE; +- offers significantly better output quality with Anime4K v4, RealESRGAN, RealCUGAN, and RIFE; - supports two modes: filtering (upscaling) and frame interpolation; - supports Anime4K v4 and all custom MPV-compatible GLSL shaders; -- supports RealESRGAN (all three models) via ncnn and Vulkan; -- supports RIFE via ncnn and Vulkan; and +- supports RealESRGAN, RealCUGAN, and RIFE (all models) via ncnn and Vulkan; - requires zero additional disk space during processing, just space for the final output. -Support for RealCUGAN is coming soon. - ![6.2.0-screenshot](https://github.com/user-attachments/assets/68c6d65b-89a2-4553-a783-f5e663aa1313) @@ -108,10 +105,11 @@ This project includes or depends on these following projects: | Project | License | | ------------------------------------------------------------------------------------- | --------------- | -| [bloc97/Anime4K](https://github.com/bloc97/Anime4K) | MIT License | | [FFmpeg/FFmpeg](https://www.ffmpeg.org/) | LGPLv2.1, GPLv2 | -| [nihui/rife-ncnn-vulkan](https://github.com/nihui/rife-ncnn-vulkan) | MIT License | | [Tencent/ncnn](https://github.com/Tencent/ncnn) | BSD 3-Clause | +| [bloc97/Anime4K](https://github.com/bloc97/Anime4K) | MIT License | +| [nihui/realcugan-ncnn-vulkan](https://github.com/nihui/realcugan-ncnn-vulkan) | MIT License | +| [nihui/rife-ncnn-vulkan](https://github.com/nihui/rife-ncnn-vulkan) | MIT License | | [xinntao/Real-ESRGAN-ncnn-vulkan](https://github.com/xinntao/Real-ESRGAN-ncnn-vulkan) | MIT License | More licensing information can be found in the [NOTICE](NOTICE) file. diff --git a/include/libvideo2x/filter_realcugan.h b/include/libvideo2x/filter_realcugan.h new file mode 100644 index 0000000..1ecb97d --- /dev/null +++ b/include/libvideo2x/filter_realcugan.h @@ -0,0 +1,63 @@ +#pragma once + +extern "C" { +#include +} + +#include "processor.h" +#include "realcugan.h" + +namespace video2x { +namespace processors { + +// FilterRealcugan class definition +class FilterRealcugan : public Filter { + public: + // Constructor + FilterRealcugan( + int gpuid = 0, + bool tta_mode = false, + int scaling_factor = 4, + int noise_level = -1, + int num_threads = 1, + int syncgap = 3, + const fsutils::StringType model_name = STR("models-pro") + ); + + // Destructor + virtual ~FilterRealcugan() override; + + // Initializes the filter with decoder and encoder contexts + int init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *hw_ctx) override; + + // Processes an input frame and returns the processed frame + int filter(AVFrame *in_frame, AVFrame **out_frame) override; + + // Returns the filter's type + ProcessorType get_processor_type() const override { return ProcessorType::RealCUGAN; } + + // Returns the filter's output dimensions + void get_output_dimensions( + const ProcessorConfig &proc_cfg, + int in_width, + int in_height, + int &out_width, + int &out_height + ) const override; + + private: + RealCUGAN *realcugan_; + int gpuid_; + bool tta_mode_; + int scaling_factor_; + int noise_level_; + int num_threads_; + int syncgap_; + const fsutils::StringType model_name_; + AVRational in_time_base_; + AVRational out_time_base_; + AVPixelFormat out_pix_fmt_; +}; + +} // namespace processors +} // namespace video2x diff --git a/include/libvideo2x/processor.h b/include/libvideo2x/processor.h index 10fa02f..8313aad 100644 --- a/include/libvideo2x/processor.h +++ b/include/libvideo2x/processor.h @@ -23,6 +23,7 @@ enum class ProcessorType { None, Libplacebo, RealESRGAN, + RealCUGAN, RIFE, }; @@ -35,6 +36,13 @@ struct RealESRGANConfig { fsutils::StringType model_name; }; +struct RealCUGANConfig { + bool tta_mode = false; + int num_threads = 1; + int syncgap = 3; + fsutils::StringType model_name; +}; + struct RIFEConfig { bool tta_mode = false; bool tta_temporal_mode = false; @@ -49,9 +57,10 @@ struct ProcessorConfig { int width = 0; int height = 0; int scaling_factor = 0; + int noise_level = -1; int frm_rate_mul = 0; float scn_det_thresh = 0.0f; - std::variant config; + std::variant config; }; class Processor { diff --git a/models/realcugan/models-nose/up2x-no-denoise.bin b/models/realcugan/models-nose/up2x-no-denoise.bin new file mode 100644 index 0000000..3d7fa15 Binary files /dev/null and b/models/realcugan/models-nose/up2x-no-denoise.bin differ diff --git a/models/realcugan/models-nose/up2x-no-denoise.param b/models/realcugan/models-nose/up2x-no-denoise.param new file mode 100644 index 0000000..9b2f2e2 --- /dev/null +++ b/models/realcugan/models-nose/up2x-no-denoise.param @@ -0,0 +1,37 @@ +7767517 +35 39 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 4 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Crop slice_43 1 1 5 9 -23309=2,4,4 -23310=2,-4,-4 -23311=2,1,2 +Deconvolution deconvrelu_0 1 1 8 10 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_0 2 1 10 9 11 +Convolution convrelu_5 1 1 11 12 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_20 1 1 12 13 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_1 1 2 13 14 15 +Convolution convrelu_6 1 1 14 16 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_7 1 1 16 17 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_2 1 2 17 18 19 +Convolution convrelu_8 1 1 18 20 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_9 1 1 20 21 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 21 22 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 22 23 24 +Convolution convrelu_11 1 1 23 25 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_12 1 1 25 26 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_13 1 1 26 27 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Crop slice_44 1 1 24 28 -23309=2,4,4 -23310=2,-4,-4 -23311=2,1,2 +Deconvolution deconvrelu_1 1 1 27 29 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 29 28 30 +Convolution convrelu_14 1 1 30 31 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 31 32 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Crop slice_45 1 1 19 33 -23309=2,16,16 -23310=2,-16,-16 -23311=2,1,2 +Deconvolution deconvrelu_2 1 1 32 34 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_2 2 1 34 33 35 +Convolution convrelu_16 1 1 35 36 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_18 1 1 36 37 0=3 1=3 5=1 6=1728 +Crop slice_46 1 1 15 38 -23309=2,20,20 -23310=2,-20,-20 -23311=2,1,2 +BinaryOp add_3 2 1 37 38 out0 diff --git a/models/realcugan/models-pro/up2x-conservative.bin b/models/realcugan/models-pro/up2x-conservative.bin new file mode 100644 index 0000000..b523e90 Binary files /dev/null and b/models/realcugan/models-pro/up2x-conservative.bin differ diff --git a/models/realcugan/models-pro/up2x-conservative.param b/models/realcugan/models-pro/up2x-conservative.param new file mode 100644 index 0000000..fad6254 --- /dev/null +++ b/models/realcugan/models-pro/up2x-conservative.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 10 11 12 +Pooling mean_64 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_2 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_3 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 20 21 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 30 31 32 +Pooling mean_65 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_4 2 1 31 35 36 0=2 +Split splitncnn_5 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 41 42 43 +Pooling mean_66 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_5 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 52 53 54 +Pooling mean_67 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_7 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_8 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 63 64 0=3 1=3 5=1 6=1728 +BinaryOp add_9 2 1 64 62 out0 diff --git a/models/realcugan/models-pro/up2x-denoise3x.bin b/models/realcugan/models-pro/up2x-denoise3x.bin new file mode 100644 index 0000000..6bf12cd Binary files /dev/null and b/models/realcugan/models-pro/up2x-denoise3x.bin differ diff --git a/models/realcugan/models-pro/up2x-denoise3x.param b/models/realcugan/models-pro/up2x-denoise3x.param new file mode 100644 index 0000000..fad6254 --- /dev/null +++ b/models/realcugan/models-pro/up2x-denoise3x.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 10 11 12 +Pooling mean_64 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_2 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_3 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 20 21 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 30 31 32 +Pooling mean_65 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_4 2 1 31 35 36 0=2 +Split splitncnn_5 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 41 42 43 +Pooling mean_66 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_5 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 52 53 54 +Pooling mean_67 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_7 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_8 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 63 64 0=3 1=3 5=1 6=1728 +BinaryOp add_9 2 1 64 62 out0 diff --git a/models/realcugan/models-pro/up2x-no-denoise.bin b/models/realcugan/models-pro/up2x-no-denoise.bin new file mode 100644 index 0000000..b4c6517 Binary files /dev/null and b/models/realcugan/models-pro/up2x-no-denoise.bin differ diff --git a/models/realcugan/models-pro/up2x-no-denoise.param b/models/realcugan/models-pro/up2x-no-denoise.param new file mode 100644 index 0000000..fad6254 --- /dev/null +++ b/models/realcugan/models-pro/up2x-no-denoise.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 10 11 12 +Pooling mean_64 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_2 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_3 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 20 21 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 30 31 32 +Pooling mean_65 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_4 2 1 31 35 36 0=2 +Split splitncnn_5 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 41 42 43 +Pooling mean_66 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_5 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 52 53 54 +Pooling mean_67 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_7 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_8 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 63 64 0=3 1=3 5=1 6=1728 +BinaryOp add_9 2 1 64 62 out0 diff --git a/models/realcugan/models-pro/up3x-conservative.bin b/models/realcugan/models-pro/up3x-conservative.bin new file mode 100644 index 0000000..dfbd3d0 Binary files /dev/null and b/models/realcugan/models-pro/up3x-conservative.bin differ diff --git a/models/realcugan/models-pro/up3x-conservative.param b/models/realcugan/models-pro/up3x-conservative.param new file mode 100644 index 0000000..4493a5f --- /dev/null +++ b/models/realcugan/models-pro/up3x-conservative.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 10 11 12 +Pooling mean_64 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_2 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_3 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 20 21 0=3 1=5 3=3 4=2 5=1 6=4800 +Split splitncnn_2 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 30 31 32 +Pooling mean_65 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_4 2 1 31 35 36 0=2 +Split splitncnn_5 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 41 42 43 +Pooling mean_66 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_5 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 52 53 54 +Pooling mean_67 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_7 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_8 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 63 64 0=3 1=3 5=1 6=1728 +BinaryOp add_9 2 1 64 62 out0 diff --git a/models/realcugan/models-pro/up3x-denoise3x.bin b/models/realcugan/models-pro/up3x-denoise3x.bin new file mode 100644 index 0000000..8da9ddb Binary files /dev/null and b/models/realcugan/models-pro/up3x-denoise3x.bin differ diff --git a/models/realcugan/models-pro/up3x-denoise3x.param b/models/realcugan/models-pro/up3x-denoise3x.param new file mode 100644 index 0000000..4493a5f --- /dev/null +++ b/models/realcugan/models-pro/up3x-denoise3x.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 10 11 12 +Pooling mean_64 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_2 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_3 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 20 21 0=3 1=5 3=3 4=2 5=1 6=4800 +Split splitncnn_2 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 30 31 32 +Pooling mean_65 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_4 2 1 31 35 36 0=2 +Split splitncnn_5 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 41 42 43 +Pooling mean_66 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_5 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 52 53 54 +Pooling mean_67 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_7 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_8 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 63 64 0=3 1=3 5=1 6=1728 +BinaryOp add_9 2 1 64 62 out0 diff --git a/models/realcugan/models-pro/up3x-no-denoise.bin b/models/realcugan/models-pro/up3x-no-denoise.bin new file mode 100644 index 0000000..f00017b Binary files /dev/null and b/models/realcugan/models-pro/up3x-no-denoise.bin differ diff --git a/models/realcugan/models-pro/up3x-no-denoise.param b/models/realcugan/models-pro/up3x-no-denoise.param new file mode 100644 index 0000000..4493a5f --- /dev/null +++ b/models/realcugan/models-pro/up3x-no-denoise.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 10 11 12 +Pooling mean_64 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_2 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_3 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 20 21 0=3 1=5 3=3 4=2 5=1 6=4800 +Split splitncnn_2 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 30 31 32 +Pooling mean_65 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_4 2 1 31 35 36 0=2 +Split splitncnn_5 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 41 42 43 +Pooling mean_66 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_5 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 52 53 54 +Pooling mean_67 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_7 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_8 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 63 64 0=3 1=3 5=1 6=1728 +BinaryOp add_9 2 1 64 62 out0 diff --git a/models/realcugan/models-se/up2x-conservative.bin b/models/realcugan/models-se/up2x-conservative.bin new file mode 100644 index 0000000..fccd377 Binary files /dev/null and b/models/realcugan/models-se/up2x-conservative.bin differ diff --git a/models/realcugan/models-se/up2x-conservative.param b/models/realcugan/models-se/up2x-conservative.param new file mode 100644 index 0000000..f28c67a --- /dev/null +++ b/models/realcugan/models-se/up2x-conservative.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up2x-denoise1x.bin b/models/realcugan/models-se/up2x-denoise1x.bin new file mode 100644 index 0000000..c8ccf48 Binary files /dev/null and b/models/realcugan/models-se/up2x-denoise1x.bin differ diff --git a/models/realcugan/models-se/up2x-denoise1x.param b/models/realcugan/models-se/up2x-denoise1x.param new file mode 100644 index 0000000..f28c67a --- /dev/null +++ b/models/realcugan/models-se/up2x-denoise1x.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up2x-denoise2x.bin b/models/realcugan/models-se/up2x-denoise2x.bin new file mode 100644 index 0000000..7d6b03b Binary files /dev/null and b/models/realcugan/models-se/up2x-denoise2x.bin differ diff --git a/models/realcugan/models-se/up2x-denoise2x.param b/models/realcugan/models-se/up2x-denoise2x.param new file mode 100644 index 0000000..f28c67a --- /dev/null +++ b/models/realcugan/models-se/up2x-denoise2x.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up2x-denoise3x.bin b/models/realcugan/models-se/up2x-denoise3x.bin new file mode 100644 index 0000000..3991682 Binary files /dev/null and b/models/realcugan/models-se/up2x-denoise3x.bin differ diff --git a/models/realcugan/models-se/up2x-denoise3x.param b/models/realcugan/models-se/up2x-denoise3x.param new file mode 100644 index 0000000..f28c67a --- /dev/null +++ b/models/realcugan/models-se/up2x-denoise3x.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up2x-no-denoise.bin b/models/realcugan/models-se/up2x-no-denoise.bin new file mode 100644 index 0000000..e012338 Binary files /dev/null and b/models/realcugan/models-se/up2x-no-denoise.bin differ diff --git a/models/realcugan/models-se/up2x-no-denoise.param b/models/realcugan/models-se/up2x-no-denoise.param new file mode 100644 index 0000000..f28c67a --- /dev/null +++ b/models/realcugan/models-se/up2x-no-denoise.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=4 3=2 4=3 5=1 6=3072 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up3x-conservative.bin b/models/realcugan/models-se/up3x-conservative.bin new file mode 100644 index 0000000..d54f26d Binary files /dev/null and b/models/realcugan/models-se/up3x-conservative.bin differ diff --git a/models/realcugan/models-se/up3x-conservative.param b/models/realcugan/models-se/up3x-conservative.param new file mode 100644 index 0000000..d98eff0 --- /dev/null +++ b/models/realcugan/models-se/up3x-conservative.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=5 3=3 4=2 5=1 6=4800 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up3x-denoise3x.bin b/models/realcugan/models-se/up3x-denoise3x.bin new file mode 100644 index 0000000..3719690 Binary files /dev/null and b/models/realcugan/models-se/up3x-denoise3x.bin differ diff --git a/models/realcugan/models-se/up3x-denoise3x.param b/models/realcugan/models-se/up3x-denoise3x.param new file mode 100644 index 0000000..d98eff0 --- /dev/null +++ b/models/realcugan/models-se/up3x-denoise3x.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=5 3=3 4=2 5=1 6=4800 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up3x-no-denoise.bin b/models/realcugan/models-se/up3x-no-denoise.bin new file mode 100644 index 0000000..d38861a Binary files /dev/null and b/models/realcugan/models-se/up3x-no-denoise.bin differ diff --git a/models/realcugan/models-se/up3x-no-denoise.param b/models/realcugan/models-se/up3x-no-denoise.param new file mode 100644 index 0000000..d98eff0 --- /dev/null +++ b/models/realcugan/models-se/up3x-no-denoise.param @@ -0,0 +1,57 @@ +7767517 +55 63 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 2 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 2 3 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_0 1 2 3 4 5 +Convolution convrelu_2 1 1 5 6 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 6 7 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 7 8 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 8 9 10 +Pooling mean_64 1 1 10 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 12 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 12 13 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 9 13 14 0=2 +Crop pad_9 1 1 4 15 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 14 16 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 15 16 17 +Convolution convrelu_6 1 1 17 18 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_48 1 1 18 19 0=3 1=5 3=3 4=2 5=1 6=4800 +Split splitncnn_2 1 2 19 20 21 +Convolution convrelu_7 1 1 21 22 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 22 23 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_3 1 2 23 24 25 +Convolution convrelu_9 1 1 25 26 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 26 27 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 27 28 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 28 29 30 +Pooling mean_65 1 1 30 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 32 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 32 33 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 29 33 34 0=2 +Split splitncnn_5 1 2 34 35 36 +Convolution convrelu_13 1 1 36 37 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 37 38 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 38 39 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_6 1 2 39 40 41 +Pooling mean_66 1 1 41 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 43 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 43 44 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 40 44 45 0=2 +Crop pad_10 1 1 35 46 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 45 47 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 46 47 48 +Convolution convrelu_17 1 1 48 49 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 49 50 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 50 51 52 +Pooling mean_67 1 1 52 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 54 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 54 55 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 51 55 56 0=2 +Crop pad_11 1 1 24 57 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 56 58 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 57 58 59 +Crop pad_12 1 1 20 60 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 59 61 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_46 1 1 61 62 0=3 1=3 5=1 6=1728 +BinaryOp add_7 2 1 62 60 out0 diff --git a/models/realcugan/models-se/up4x-conservative.bin b/models/realcugan/models-se/up4x-conservative.bin new file mode 100644 index 0000000..d3ce1b1 Binary files /dev/null and b/models/realcugan/models-se/up4x-conservative.bin differ diff --git a/models/realcugan/models-se/up4x-conservative.param b/models/realcugan/models-se/up4x-conservative.param new file mode 100644 index 0000000..db3bba6 --- /dev/null +++ b/models/realcugan/models-se/up4x-conservative.param @@ -0,0 +1,60 @@ +7767517 +58 66 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_2 1 2 10 11 12 +Pooling mean_68 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_51 1 1 20 21 0=64 1=4 3=2 4=3 5=1 6=65536 +Split splitncnn_3 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_5 1 2 30 31 32 +Pooling mean_69 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 31 35 36 0=2 +Split splitncnn_6 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 41 42 43 +Pooling mean_70 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_8 1 2 52 53 54 +Pooling mean_71 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_48 1 1 63 64 0=64 1=3 5=1 6=36864 +BinaryOp add_7 2 1 64 62 65 +Convolution conv_49 1 1 65 66 0=12 1=3 5=1 6=6912 +Crop pad_13 1 1 66 67 -23309=2,1,1 -23310=2,-1,-1 -23311=2,-2,-1 +PixelShuffle pixelshuffle_66 1 1 67 out0 0=2 diff --git a/models/realcugan/models-se/up4x-denoise3x.bin b/models/realcugan/models-se/up4x-denoise3x.bin new file mode 100644 index 0000000..798ff53 Binary files /dev/null and b/models/realcugan/models-se/up4x-denoise3x.bin differ diff --git a/models/realcugan/models-se/up4x-denoise3x.param b/models/realcugan/models-se/up4x-denoise3x.param new file mode 100644 index 0000000..db3bba6 --- /dev/null +++ b/models/realcugan/models-se/up4x-denoise3x.param @@ -0,0 +1,60 @@ +7767517 +58 66 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_2 1 2 10 11 12 +Pooling mean_68 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_51 1 1 20 21 0=64 1=4 3=2 4=3 5=1 6=65536 +Split splitncnn_3 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_5 1 2 30 31 32 +Pooling mean_69 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 31 35 36 0=2 +Split splitncnn_6 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 41 42 43 +Pooling mean_70 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_8 1 2 52 53 54 +Pooling mean_71 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_48 1 1 63 64 0=64 1=3 5=1 6=36864 +BinaryOp add_7 2 1 64 62 65 +Convolution conv_49 1 1 65 66 0=12 1=3 5=1 6=6912 +Crop pad_13 1 1 66 67 -23309=2,1,1 -23310=2,-1,-1 -23311=2,-2,-1 +PixelShuffle pixelshuffle_66 1 1 67 out0 0=2 diff --git a/models/realcugan/models-se/up4x-no-denoise.bin b/models/realcugan/models-se/up4x-no-denoise.bin new file mode 100644 index 0000000..e05d8c0 Binary files /dev/null and b/models/realcugan/models-se/up4x-no-denoise.bin differ diff --git a/models/realcugan/models-se/up4x-no-denoise.param b/models/realcugan/models-se/up4x-no-denoise.param new file mode 100644 index 0000000..db3bba6 --- /dev/null +++ b/models/realcugan/models-se/up4x-no-denoise.param @@ -0,0 +1,60 @@ +7767517 +58 66 +Input in0 0 1 in0 +Convolution convrelu_0 1 1 in0 4 0=32 1=3 5=1 6=864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_1 1 1 4 5 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_1 1 2 5 6 7 +Convolution convrelu_2 1 1 7 8 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_3 1 1 8 9 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_4 1 1 9 10 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_2 1 2 10 11 12 +Pooling mean_68 1 1 12 gap0 0=1 4=1 +InnerProduct convrelu_5 1 1 gap0 14 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_21 1 1 14 15 0=64 1=1 2=512 9=4 +BinaryOp mul_0 2 1 11 15 16 0=2 +Crop pad_9 1 1 6 17 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_0 1 1 16 18 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_1 2 1 17 18 19 +Convolution convrelu_6 1 1 19 20 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Deconvolution deconv_51 1 1 20 21 0=64 1=4 3=2 4=3 5=1 6=65536 +Split splitncnn_3 1 2 21 22 23 +Convolution convrelu_7 1 1 23 24 0=32 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Convolution convrelu_8 1 1 24 25 0=64 1=3 5=1 6=18432 9=2 -23310=1,1.000000e-01 +Split splitncnn_4 1 2 25 26 27 +Convolution convrelu_9 1 1 27 28 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +Convolution convrelu_10 1 1 28 29 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution convrelu_11 1 1 29 30 0=128 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Split splitncnn_5 1 2 30 31 32 +Pooling mean_69 1 1 32 gap1 0=1 4=1 +InnerProduct convrelu_12 1 1 gap1 34 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_22 1 1 34 35 0=128 1=1 2=2048 9=4 +BinaryOp mul_2 2 1 31 35 36 0=2 +Split splitncnn_6 1 2 36 37 38 +Convolution convrelu_13 1 1 38 39 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +Convolution convrelu_14 1 1 39 40 0=256 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Convolution convrelu_15 1 1 40 41 0=128 1=3 5=1 6=294912 9=2 -23310=1,1.000000e-01 +Split splitncnn_7 1 2 41 42 43 +Pooling mean_70 1 1 43 gap2 0=1 4=1 +InnerProduct convrelu_16 1 1 gap2 45 0=16 1=1 2=2048 9=1 +InnerProduct convsigmoid_23 1 1 45 46 0=128 1=1 2=2048 9=4 +BinaryOp mul_3 2 1 42 46 47 0=2 +Crop pad_10 1 1 37 48 -23309=2,4,4 -23310=2,-4,-4 -23311=2,-2,-1 +Deconvolution deconvrelu_1 1 1 47 49 0=128 1=2 3=2 5=1 6=65536 9=2 -23310=1,1.000000e-01 +BinaryOp add_4 2 1 48 49 50 +Convolution convrelu_17 1 1 50 51 0=64 1=3 5=1 6=73728 9=2 -23310=1,1.000000e-01 +Convolution convrelu_18 1 1 51 52 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Split splitncnn_8 1 2 52 53 54 +Pooling mean_71 1 1 54 gap3 0=1 4=1 +InnerProduct convrelu_19 1 1 gap3 56 0=8 1=1 2=512 9=1 +InnerProduct convsigmoid_24 1 1 56 57 0=64 1=1 2=512 9=4 +BinaryOp mul_5 2 1 53 57 58 0=2 +Crop pad_11 1 1 26 59 -23309=2,16,16 -23310=2,-16,-16 -23311=2,-2,-1 +Deconvolution deconvrelu_2 1 1 58 60 0=64 1=2 3=2 5=1 6=16384 9=2 -23310=1,1.000000e-01 +BinaryOp add_6 2 1 59 60 61 +Crop pad_12 1 1 22 62 -23309=2,20,20 -23310=2,-20,-20 -23311=2,-2,-1 +Convolution convrelu_20 1 1 61 63 0=64 1=3 5=1 6=36864 9=2 -23310=1,1.000000e-01 +Convolution conv_48 1 1 63 64 0=64 1=3 5=1 6=36864 +BinaryOp add_7 2 1 64 62 65 +Convolution conv_49 1 1 65 66 0=12 1=3 5=1 6=6912 +Crop pad_13 1 1 66 67 -23309=2,1,1 -23310=2,-1,-1 -23311=2,-2,-1 +PixelShuffle pixelshuffle_66 1 1 67 out0 0=2 diff --git a/src/filter_realcugan.cpp b/src/filter_realcugan.cpp new file mode 100644 index 0000000..2cc763d --- /dev/null +++ b/src/filter_realcugan.cpp @@ -0,0 +1,207 @@ +#include "filter_realcugan.h" + +#include +#include +#include + +#include + +#include "conversions.h" +#include "fsutils.h" +#include "logger_manager.h" + +namespace video2x { +namespace processors { + +FilterRealcugan::FilterRealcugan( + int gpuid, + bool tta_mode, + int scaling_factor, + int noise_level, + int num_threads, + int syncgap, + const fsutils::StringType model_name +) + : realcugan_(nullptr), + gpuid_(gpuid), + tta_mode_(tta_mode), + scaling_factor_(scaling_factor), + noise_level_(noise_level), + num_threads_(num_threads), + syncgap_(syncgap), + model_name_(std::move(model_name)) {} + +FilterRealcugan::~FilterRealcugan() { + if (realcugan_) { + delete realcugan_; + realcugan_ = nullptr; + } +} + +int FilterRealcugan::init(AVCodecContext *dec_ctx, AVCodecContext *enc_ctx, AVBufferRef *) { + // Construct the model paths using std::filesystem + std::filesystem::path model_param_path; + std::filesystem::path model_bin_path; + + fsutils::StringType model_base_name = + STR("up") + fsutils::to_string_type(scaling_factor_) + STR("x-"); + + switch (noise_level_) { + case -1: + model_base_name += STR("conservative"); + break; + case 0: + model_base_name += STR("no-denoise"); + break; + default: + model_base_name += STR("denoise") + fsutils::to_string_type(noise_level_) + STR("x"); + break; + } + + fsutils::StringType param_file_name = model_base_name + STR(".param"); + fsutils::StringType bin_file_name = model_base_name + STR(".bin"); + + // Find the model paths by model name if provided + model_param_path = + std::filesystem::path(STR("models")) / STR("realcugan") / model_name_ / param_file_name; + model_bin_path = + std::filesystem::path(STR("models")) / STR("realcugan") / model_name_ / bin_file_name; + + // Get the full paths using a function that possibly modifies or validates the path + std::filesystem::path model_param_full_path = fsutils::find_resource_file(model_param_path); + std::filesystem::path model_bin_full_path = fsutils::find_resource_file(model_bin_path); + + // Check if the model files exist + if (!std::filesystem::exists(model_param_full_path)) { + logger()->error("RealCUGAN model param file not found: {}", model_param_path.u8string()); + return -1; + } + if (!std::filesystem::exists(model_bin_full_path)) { + logger()->error("RealCUGAN model bin file not found: {}", model_bin_path.u8string()); + return -1; + } + + // Create a new RealCUGAN instance + realcugan_ = new RealCUGAN(gpuid_, tta_mode_, num_threads_); + + // Store the time bases + in_time_base_ = dec_ctx->time_base; + out_time_base_ = enc_ctx->time_base; + out_pix_fmt_ = enc_ctx->pix_fmt; + + // Load the model + if (realcugan_->load(model_param_full_path, model_bin_full_path) != 0) { + logger()->error("Failed to load RealCUGAN model"); + return -1; + } + + // Set syncgap to 0 for models-nose + if (model_name_.find(STR("models-nose")) != fsutils::StringType::npos) { + syncgap_ = 0; + } + + // Set realcugan parameters + realcugan_->scale = scaling_factor_; + realcugan_->noise = noise_level_; + realcugan_->prepadding = 10; + + // Set prepadding based on scaling factor + if (scaling_factor_ == 2) { + realcugan_->prepadding = 18; + } + if (scaling_factor_ == 3) { + realcugan_->prepadding = 14; + } + if (scaling_factor_ == 4) { + realcugan_->prepadding = 19; + } + + // Calculate tilesize based on GPU heap budget + uint32_t heap_budget = ncnn::get_gpu_device(gpuid_)->get_heap_budget(); + if (scaling_factor_ == 2) { + if (heap_budget > 1300) { + realcugan_->tilesize = 400; + } else if (heap_budget > 800) { + realcugan_->tilesize = 300; + } else if (heap_budget > 400) { + realcugan_->tilesize = 200; + } else if (heap_budget > 200) { + realcugan_->tilesize = 100; + } else { + realcugan_->tilesize = 32; + } + } + if (scaling_factor_ == 3) { + if (heap_budget > 3300) { + realcugan_->tilesize = 400; + } else if (heap_budget > 1900) { + realcugan_->tilesize = 300; + } else if (heap_budget > 950) { + realcugan_->tilesize = 200; + } else if (heap_budget > 320) { + realcugan_->tilesize = 100; + } else { + realcugan_->tilesize = 32; + } + } + if (scaling_factor_ == 4) { + if (heap_budget > 1690) { + realcugan_->tilesize = 400; + } else if (heap_budget > 980) { + realcugan_->tilesize = 300; + } else if (heap_budget > 530) { + realcugan_->tilesize = 200; + } else if (heap_budget > 240) { + realcugan_->tilesize = 100; + } else { + realcugan_->tilesize = 32; + } + } + + return 0; +} + +int FilterRealcugan::filter(AVFrame *in_frame, AVFrame **out_frame) { + int ret; + + // Convert the input frame to RGB24 + ncnn::Mat in_mat = conversions::avframe_to_ncnn_mat(in_frame); + if (in_mat.empty()) { + logger()->error("Failed to convert AVFrame to ncnn::Mat"); + return -1; + } + + // Allocate space for output ncnn::Mat + int output_width = in_mat.w * realcugan_->scale; + int output_height = in_mat.h * realcugan_->scale; + ncnn::Mat out_mat = ncnn::Mat(output_width, output_height, static_cast(3), 3); + + ret = realcugan_->process(in_mat, out_mat); + if (ret != 0) { + logger()->error("RealCUGAN processing failed"); + return ret; + } + + // Convert ncnn::Mat to AVFrame + *out_frame = conversions::ncnn_mat_to_avframe(out_mat, out_pix_fmt_); + + // Rescale PTS to encoder's time base + (*out_frame)->pts = av_rescale_q(in_frame->pts, in_time_base_, out_time_base_); + + // Return the processed frame to the caller + return ret; +} + +void FilterRealcugan::get_output_dimensions( + const ProcessorConfig &, + int in_width, + int in_height, + int &out_width, + int &out_height +) const { + out_width = in_width * scaling_factor_; + out_height = in_height * scaling_factor_; +} + +} // namespace processors +} // namespace video2x diff --git a/src/processor_factory.cpp b/src/processor_factory.cpp index 46e1331..9ea83ec 100644 --- a/src/processor_factory.cpp +++ b/src/processor_factory.cpp @@ -4,6 +4,7 @@ #include #include "filter_libplacebo.h" +#include "filter_realcugan.h" #include "filter_realesrgan.h" #include "interpolator_rife.h" #include "logger_manager.h" @@ -95,6 +96,31 @@ void ProcessorFactory::init_default_processors(ProcessorFactory &factory) { } ); + factory.register_processor( + ProcessorType::RealCUGAN, + [](const ProcessorConfig &proc_cfg, + uint32_t vk_device_index) -> std::unique_ptr { + const auto &config = std::get(proc_cfg.config); + if (proc_cfg.scaling_factor <= 0) { + logger()->critical("Scaling factor must be provided for the RealCUGAN filter"); + return nullptr; + } + if (config.model_name.empty()) { + logger()->critical("Model name must be provided for the RealCUGAN filter"); + return nullptr; + } + return std::make_unique( + static_cast(vk_device_index), + config.tta_mode, + proc_cfg.scaling_factor, + proc_cfg.noise_level, + config.num_threads, + config.syncgap, + config.model_name + ); + } + ); + factory.register_processor( ProcessorType::RIFE, [](const ProcessorConfig &proc_cfg, diff --git a/third_party/librealcugan_ncnn_vulkan b/third_party/librealcugan_ncnn_vulkan new file mode 160000 index 0000000..52f5982 --- /dev/null +++ b/third_party/librealcugan_ncnn_vulkan @@ -0,0 +1 @@ +Subproject commit 52f598265a973fc8b17eb5e13cddc0e71c0a79dc diff --git a/third_party/librealesrgan_ncnn_vulkan b/third_party/librealesrgan_ncnn_vulkan index cd68df6..7966e68 160000 --- a/third_party/librealesrgan_ncnn_vulkan +++ b/third_party/librealesrgan_ncnn_vulkan @@ -1 +1 @@ -Subproject commit cd68df6f98f036fcc9e7d63597ea6faa427c2d2d +Subproject commit 7966e68979ab9c002d10f9bfa507bd25e551b377 diff --git a/third_party/librife_ncnn_vulkan b/third_party/librife_ncnn_vulkan index f2edda4..b3b2ce8 160000 --- a/third_party/librife_ncnn_vulkan +++ b/third_party/librife_ncnn_vulkan @@ -1 +1 @@ -Subproject commit f2edda49a5fd817a7137509e54e70d2e30d9b684 +Subproject commit b3b2ce899011fa7940178163f0b4a3ebc251a934 diff --git a/third_party/ncnn b/third_party/ncnn index 9b5f6a3..a6d3ef5 160000 --- a/third_party/ncnn +++ b/third_party/ncnn @@ -1 +1 @@ -Subproject commit 9b5f6a39b4a4962accaad58caa771487f61f732a +Subproject commit a6d3ef5a0bb59fb496c553c3ef54d141642b4fc5 diff --git a/tools/video2x/include/validators.h b/tools/video2x/include/validators.h index 8e10111..12e11cd 100644 --- a/tools/video2x/include/validators.h +++ b/tools/video2x/include/validators.h @@ -65,4 +65,6 @@ void validate_anime4k_shader_name(const video2x::fsutils::StringType &shader_nam void validate_realesrgan_model_name(const video2x::fsutils::StringType &model_name); +void validate_realcugan_model_name(const video2x::fsutils::StringType &model_name); + void validate_rife_model_name(const video2x::fsutils::StringType &model_name); diff --git a/tools/video2x/src/argparse.cpp b/tools/video2x/src/argparse.cpp index 19b0e55..80a5976 100644 --- a/tools/video2x/src/argparse.cpp +++ b/tools/video2x/src/argparse.cpp @@ -79,7 +79,7 @@ int parse_args( ("input,i", PO_STR_VALUE(), "Input video file path") ("output,o", PO_STR_VALUE(), "Output video file path") ("processor,p", PO_STR_VALUE(), - "Processor to use (libplacebo, realesrgan, rife)") + "Processor to use (libplacebo, realesrgan, realcugan, rife)") ("hwaccel,a", PO_STR_VALUE() ->default_value(STR("none"), "none"), "Hardware acceleration method (decoding)") ("device,d", po::value(&arguments.vk_device_index)->default_value(0), @@ -131,6 +131,8 @@ int parse_args( ->notifier([](int v) { validate_greater_equal_one(v, "height"); }), "Output height") ("scaling-factor,s", po::value(&proc_cfg.scaling_factor) ->notifier([](int v) { validate_min(v, "scaling-factor", 2); }), "Scaling factor") + ("noise-level,n", po::value(&proc_cfg.noise_level) + ->notifier([](int v) { validate_min(v, "noise-level", 0); }), "Noise level") ; po::options_description interp_opts("Frame interpolation options"); @@ -161,6 +163,18 @@ int parse_args( "realesrgan-plus)") ; + po::options_description realcugan_opts("RealCUGAN options"); + realesrgan_opts.add_options() + ("realcugan-model", PO_STR_VALUE() + ->default_value(STR("models-se"), "models-se") + ->notifier(validate_realcugan_model_name), + "Name of the RealCUGAN model to use (models-nose, models-pro, models-se)") + ("realcugan-threads", po::value()->default_value(1), + "Number of threads to use for RealCUGAN") + ("realcugan-syncgap", po::value()->default_value(3), + "Sync gap mode; 0:no sync, 1: accurate sync: 2 = rough sync, 3: very rough sync") + ; + po::options_description rife_opts("RIFE options"); rife_opts.add_options() ("rife-model", PO_STR_VALUE() @@ -261,12 +275,12 @@ int parse_args( proc_cfg.processor_type = video2x::processors::ProcessorType::Libplacebo; } else if (processor_type_str == STR("realesrgan")) { proc_cfg.processor_type = video2x::processors::ProcessorType::RealESRGAN; + } else if (processor_type_str == STR("realcugan")) { + proc_cfg.processor_type = video2x::processors::ProcessorType::RealCUGAN; } else if (processor_type_str == STR("rife")) { proc_cfg.processor_type = video2x::processors::ProcessorType::RIFE; } else { - video2x::logger()->critical( - "Invalid processor specified. Must be 'libplacebo', 'realesrgan', or 'rife'." - ); + video2x::logger()->critical("Invalid processor specified."); return -1; } } else { @@ -370,8 +384,7 @@ int parse_args( ); return -1; } - if (proc_cfg.scaling_factor != 2 && proc_cfg.scaling_factor != 3 && - proc_cfg.scaling_factor != 4) { + if (proc_cfg.scaling_factor < 2 || proc_cfg.scaling_factor > 4) { video2x::logger()->critical( "Scaling factor must be set to 2, 3, or 4 for RealESRGAN." ); @@ -386,6 +399,47 @@ int parse_args( proc_cfg.config = realesrgan_config; break; } + case video2x::processors::ProcessorType::RealCUGAN: { + if (!vm.count("realcugan-model")) { + video2x::logger()->critical("RealCUGAN model name must be set for RealCUGAN."); + return -1; + } + if (vm.count("realcugan-threads") && vm["realcugan-threads"].as() < 1) { + video2x::logger()->critical( + "Number of threads must be at least 1 for RealCUGAN." + ); + return -1; + } + if (vm.count("realcugan-syncgap") && (vm["realcugan-syncgap"].as() < 0 || + vm["realcugan-syncgap"].as() > 3)) { + video2x::logger()->critical( + "Sync gap mode must be set to 0, 1, 2, or 3 for RealCUGAN." + ); + return -1; + } + if (proc_cfg.scaling_factor < 2 || proc_cfg.scaling_factor > 4) { + video2x::logger()->critical( + "Scaling factor must be set to 2, 3, or 4 for RealCUGAN." + ); + return -1; + } + if (proc_cfg.noise_level < -1 || proc_cfg.noise_level > 3) { + video2x::logger()->critical( + "Noise level must be set to -1, 0, 1, 2, or 3 for RealCUGAN." + ); + return -1; + } + + proc_cfg.processor_type = video2x::processors::ProcessorType::RealCUGAN; + video2x::processors::RealCUGANConfig realcugan_config; + realcugan_config.tta_mode = false; + realcugan_config.model_name = + vm["realcugan-model"].as(); + realcugan_config.num_threads = vm["realcugan-threads"].as(); + realcugan_config.syncgap = vm["realcugan-syncgap"].as(); + proc_cfg.config = realcugan_config; + break; + } case video2x::processors::ProcessorType::RIFE: { if (!vm.count("rife-model")) { video2x::logger()->critical("RIFE model name must be set for RIFE."); diff --git a/tools/video2x/src/validators.cpp b/tools/video2x/src/validators.cpp index c557347..14ef5e0 100644 --- a/tools/video2x/src/validators.cpp +++ b/tools/video2x/src/validators.cpp @@ -36,8 +36,21 @@ void validate_realesrgan_model_name(const video2x::fsutils::StringType &model_na } } +void validate_realcugan_model_name(const video2x::fsutils::StringType &model_name) { + static const std::unordered_set valid_realcugan_models = { + STR("models-nose"), STR("models-pro"), STR("models-se") + }; + if (valid_realcugan_models.count(model_name) == 0) { + throw po::validation_error( + po::validation_error::invalid_option_value, + "realcugan-model", + "realcugan-model must be one of: models-nose, models-pro, models-se" + ); + } +} + void validate_rife_model_name(const video2x::fsutils::StringType &model_name) { - static const std::unordered_set valid_realesrgan_models = { + static const std::unordered_set valid_rife_models = { STR("rife"), STR("rife-HD"), STR("rife-UHD"), @@ -50,7 +63,7 @@ void validate_rife_model_name(const video2x::fsutils::StringType &model_name) { STR("rife-v4"), STR("rife-v4.6"), }; - if (valid_realesrgan_models.count(model_name) == 0) { + if (valid_rife_models.count(model_name) == 0) { throw po::validation_error( po::validation_error::invalid_option_value, "rife-model",