diff --git a/common/waifu2x.cpp b/common/waifu2x.cpp index 05d5f45..309f146 100644 --- a/common/waifu2x.cpp +++ b/common/waifu2x.cpp @@ -29,6 +29,10 @@ const auto offset = 0; const auto layer_num = 7; const auto output_size = block_size - offset * 2; +const auto block_width_height = block_size + layer_num * 2; + +const auto original_width_height = 128 + layer_num * 2; + const int ConvertMode = CV_RGB2YUV; const int ConvertInverseMode = CV_YUV2RGB; @@ -311,6 +315,14 @@ eWaifu2xError ConstractNet(boost::shared_ptr> &net, const std: else layer_param->mutable_relu_param()->set_engine(caffe::ReLUParameter_Engine_CAFFE); } + else if (type == "MemoryData") + { + if (layer_param->mutable_memory_data_param()->width() == original_width_height && layer_param->mutable_memory_data_param()->height() == original_width_height) + { + layer_param->mutable_memory_data_param()->set_width(block_width_height); + layer_param->mutable_memory_data_param()->set_height(block_width_height); + } + } } net = boost::shared_ptr>(new caffe::Net(param));