{"id":397,"date":"2022-04-02T07:33:53","date_gmt":"2022-04-02T07:33:53","guid":{"rendered":"https:\/\/blog.liguanxin.cn\/?p=397"},"modified":"2022-04-02T07:37:35","modified_gmt":"2022-04-02T07:37:35","slug":"%e8%ae%ba%e6%96%87%e7%ac%94%e8%ae%b0-practical-blind-denoising-via-swin-conv-unet-and-data-synthesis","status":"publish","type":"post","link":"https:\/\/blog.liguanxin.cn\/index.php\/2022\/04\/02\/%e8%ae%ba%e6%96%87%e7%ac%94%e8%ae%b0-practical-blind-denoising-via-swin-conv-unet-and-data-synthesis\/","title":{"rendered":"\u8bba\u6587\u7b14\u8bb0\u2014\u2014Practical Blind Denoising via Swin-Conv-UNet and Data Synthesis"},"content":{"rendered":"<p>\uff08CVPR2022\u7684\u53bb\u566a\u8bba\u6587\uff09<\/p>\n<p><strong>\u521b\u65b0\u70b9\uff1a<br \/>\n\u2460\u672c\u6587\u63d0\u51faSwin-Conv\u6a21\u5757\uff0c\u5c06DRUNet\u548cSwinIR\u7684\u7ed3\u5408\u8d77\u6765\uff0c\u5e76\u63d2\u5165\u5230UNet\u67b6\u6784\u4e2d\uff0c\u8fd8\u8bbe\u8ba1\u4e86\u4e00\u4e2a\u5b9e\u7528\u7684\u566a\u58f0\u9000\u5316\u6a21\u578b\uff0c\u6700\u7ec8\u5728\u76f2\u56fe\u50cf\u53bb\u566a\u4e0a\u8868\u73b0SOTA\u3002<br \/>\n\u2461\u8bbe\u8ba1\u4e86\u4e00\u4e2a\u5b9e\u7528\u7684\u566a\u58f0\u9000\u5316\u6a21\u578b\uff0c\u8be5\u6a21\u578b\u8003\u8651\u4e86\u4e0d\u540c\u7c7b\u578b\u7684\u566a\u58f0(\u5305\u62ec\u9ad8\u65af\u566a\u58f0\u3001\u6cca\u677e\u566a\u58f0\u3001\u6563\u6591\u566a\u58f0\u3001JPEG\u538b\u7f29\u566a\u58f0\u548c\u5904\u7406\u8fc7\u7684\u6444\u50cf\u673a\u4f20\u611f\u5668\u566a\u58f0)\u548c\u8c03\u6574\u5927\u5c0f\uff0c\u5e76\u6d89\u53ca\u5230\u968f\u673a\u6d17\u724c\u7b56\u7565\u548c\u53cc\u9000\u5316\u7b56\u7565\u3002<\/strong><\/p>\n<p>\u7814\u7a76\u65b9\u5411\uff1a<\/p>\n<ul>\n<li>\u7b2c\u4e00\u4e2a\u662f\u5728n\u662f\u52a0\u6027\u9ad8\u65af\u767d\u566a\u58f0(AWGN)\u7684\u5047\u8bbe\u4e0b\u63d0\u9ad8\u6027\u80fd\u3002<\/li>\n<li>\u7b2c\u4e8c\u79cd\u65b9\u6cd5\u4e3b\u8981\u96c6\u4e2d\u5728\u8bad\u7ec3\u6570\u636e\u6216\u566a\u58f0\u5efa\u6a21\u4e0a\u3002<\/li>\n<\/ul>\n<h1>\u4f18\u5316\u95ee\u9898<\/h1>\n<p><img src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/04\/\u5fae\u4fe1\u622a\u56fe_20220402142829.png\" alt=\"\" \/><br \/>\n\u901a\u5e38\u76f2\u53bb\u566a\u662f\u4e3a\u4e86\u89e3\u51b3\u4ee5\u4e0b\u53cc\u7ea7\u4f18\u5316\u95ee\u9898<br \/>\n<img src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/04\/\u5fae\u4fe1\u622a\u56fe_20220402141809.png\" alt=\"\" \/><br \/>\n\u5176\u4e2dW\u4ee3\u8868\u7f51\u7edc\u8981\u5b66\u4e60\u7684\u53c2\u6570\uff0c{<span class=\"katex-eq\" data-katex-display=\"false\">y_i, x_i<\/span>}\u4ee3\u8868\u566a\u58f0-\u5e72\u51c0\u56fe\u50cf\u5bf9\uff0cL()\u662f\u635f\u5931\u51fd\u6570\uff0c\u03bb\u662f\u5148\u9a8c\u9879\u6743\u91cd\u3002<\/p>\n<hr \/>\n<h1>\u7f51\u7edc\u7ed3\u6784Swin-Conv-UNet<\/h1>\n<p><img src=\"https:\/\/blog.liguanxin.cn\/wp-content\/uploads\/2022\/04\/\u5fae\u4fe1\u622a\u56fe_20220402143258.png\" alt=\"\" \/><br \/>\n\u56fe\u4e2d\u7070\u8272\u6846\u662fSC Block\uff0c\u901a\u8fc7\u4e00\u4e2a1*1\u5377\u79ef\uff0c\u7136\u540e\u5747\u5300split\u6210\u4e24\u4e2a\u5206\u652f\uff08\u7ef4\u5ea6\u5e73\u5206\uff09\uff0c\u8fdb\u5165SwinT Block\u548cRConv Block\uff08\u6b8b\u5dee\u5377\u79ef\u5757\u2014&gt;<span class=\"katex-eq\" data-katex-display=\"false\">3*3<\/span>\uff0cReLU\uff0c<span class=\"katex-eq\" data-katex-display=\"false\">3*3<\/span>\uff09\uff0c\u7136\u540econcat\u8fdb\u5165<span class=\"katex-eq\" data-katex-display=\"false\">1*1<\/span>\u5377\u79ef\u3002<br \/>\n\u7c89\u8272\u6846\u662fSConv\u4ee3\u8868<span class=\"katex-eq\" data-katex-display=\"false\">2*2<\/span>\u6b65\u957f\u4e3a2\u7684\u5377\u79ef\u3002<br \/>\n\u84dd\u8272\u6846\u662fTCconv\u4ee3\u8868<span class=\"katex-eq\" data-katex-display=\"false\">2*2<\/span>\u6b65\u957f\u4e3a2\u7684\u53cd\u5377\u79ef\u3002<br \/>\n\u4ece\u7b2c\u4e00\u5c3a\u5ea6\u5230\u7b2c\u56db\u5c3a\u5ea6\uff0c\u6bcf\u4e00\u5c42\u7684\u901a\u9053\u6570\u5206\u522b\u4e3a64\u3001128\u3001256\u548c512\u3002<\/p>\n<p>SCUNet\u5728\u7f29\u5c0f\u548c\u5347\u7ea7\u7684\u6bcf\u4e2a\u5c3a\u5ea6\u4e0a\u90fd\u91c7\u7528\u4e864\u4e2aSC\u5757\uff0c\u800c\u4e0d\u662f4\u4e2a\u6b8b\u5dee\u5377\u79ef\u5757\u3002<\/p>\n<h1>CODE<\/h1>\n<p>\u6574\u4f53\u7ed3\u6784\u662f\u4e00\u4e2aSCUNet<\/p>\n<pre><code class=\"language-python\">class SCUNet(nn.Module):\n\n    def __init__(self, in_nc=3, config=[2,2,2,2,2,2,2], dim=64, drop_path_rate=0.0, input_resolution=256):\n        super(SCUNet, self).__init__()\n        self.config = config\n        self.dim = dim\n        self.head_dim = 32\n        self.window_size = 8\n\n        # drop path rate for each layer\n        dpr = [x.item() for x in torch.linspace(0, drop_path_rate, sum(config))]\n\n        self.m_head = [nn.Conv2d(in_nc, dim, 3, 1, 1, bias=False)]\n\n        begin = 0\n        self.m_down1 = [ConvTransBlock(dim\/\/2, dim\/\/2, self.head_dim, self.window_size, dpr[i+begin], &#039;W&#039; if not i%2 else &#039;SW&#039;, input_resolution) \n                      for i in range(config[0])] + \\\n                      [nn.Conv2d(dim, 2*dim, 2, 2, 0, bias=False)]\n        ...\n\n    def forward(self, x0):\n\n        # \u56fe\u7247\u9ad8\u5bbd\u4e0d\u8db364\u8865\u5168\u523064\n        h, w = x0.size()[-2:]\n        paddingBottom = int(np.ceil(h\/64)*64-h)\n        paddingRight = int(np.ceil(w\/64)*64-w)\n        x0 = nn.ReplicationPad2d((0, paddingRight, 0, paddingBottom))(x0)\n\n        # \u7b2c\u4e00\u4e2a3*3\u5377\u79ef\n        x1 = self.m_head(x0)  # 64\n        # \u4e24\u4e2aSC Block\uff08\u4e00\u4e2a\u6b63\u5e38\u7a97\u53e3\uff0c\u4e00\u4e2a\u6ed1\u52a8\u7a97\u53e3\uff09\u548c\u4e00\u4e2a2*2\u4e0b\u91c7\u6837\u5377\u79ef\n        x2 = self.m_down1(x1)  # 128\n        # \u4e24\u4e2aSC Block\u548c\u4e00\u4e2a2*2\u4e0b\u91c7\u6837\u5377\u79ef\n        x3 = self.m_down2(x2)  # 256\n        # \u4e24\u4e2aSC Block\u548c\u4e00\u4e2a2*2\u4e0b\u91c7\u6837\u5377\u79ef\n        x4 = self.m_down3(x3)  # 512\n        # U\u578b\u7ed3\u6784\u5e95\u5c42\u4e5f\u662f\u4e24\u4e2aSC Block\n        x = self.m_body(x4)  # 512\n        # \u7ecf\u8fc7\u4e00\u4e2a2*2\u53cd\u5377\u79ef\u7136\u540e\u662f\u4e24\u4e2aSC Block\uff0c\u6700\u540e\u8ddfx4\u505a\u6b8b\u5dee\n        x = self.m_up3(x+x4)  # 256\n        # \u7ecf\u8fc7\u4e00\u4e2a2*2\u53cd\u5377\u79ef\u7136\u540e\u662f\u4e24\u4e2aSC Block\uff0c\u6700\u540e\u8ddfx3\u505a\u6b8b\u5dee\n        x = self.m_up2(x+x3)  # 128\n        # \u7ecf\u8fc7\u4e00\u4e2a2*2\u53cd\u5377\u79ef\u7136\u540e\u662f\u4e24\u4e2aSC Block\uff0c\u6700\u540e\u8ddfx2\u505a\u6b8b\u5dee\n        x = self.m_up1(x+x2)  # 64\n        # \u6700\u540e\u6765\u4e00\u4e2a3*3\u5377\u79ef\u6536\u5c3e\n        x = self.m_tail(x+x1)\n        x = x[..., :h, :w]\n        return x<\/code><\/pre>\n<p>SC Block\uff1a<\/p>\n<pre><code class=\"language-python\">class ConvTransBlock(nn.Module):\n    def __init__(self, conv_dim, trans_dim, head_dim, window_size, drop_path, type=&#039;W&#039;, input_resolution=None):\n        &quot;&quot;&quot; SwinTransformer and Conv Block\n        &quot;&quot;&quot;\n        super(ConvTransBlock, self).__init__()\n        ...\n        self.trans_block = Block(self.trans_dim, self.trans_dim, self.head_dim, self.window_size, self.drop_path, self.type, self.input_resolution)\n        ...\n        self.conv_block = nn.Sequential(\n                nn.Conv2d(self.conv_dim, self.conv_dim, 3, 1, 1, bias=False),\n                nn.ReLU(True),\n                nn.Conv2d(self.conv_dim, self.conv_dim, 3, 1, 1, bias=False)\n                )\n\n    def forward(self, x):\n        # \u7ecf\u8fc71*1\u5377\u79ef\u4e4b\u540esplit\u6210\u4e24\u4efd\n        conv_x, trans_x = torch.split(self.conv1_1(x), (self.conv_dim, self.trans_dim), dim=1)\n        # \u6b8b\u5dee\u5377\u79ef\u5757\n        conv_x = self.conv_block(conv_x) + conv_x\n        # \u7a97\u53e3\u81ea\u6ce8\u610f\u529b\n        trans_x = Rearrange(&#039;b c h w -&gt; b h w c&#039;)(trans_x)\n        trans_x = self.trans_block(trans_x)\n        trans_x = Rearrange(&#039;b h w c -&gt; b c h w&#039;)(trans_x)\n        # \u7ed3\u679cconcat\u4e00\u8d77\n        res = self.conv1_2(torch.cat((conv_x, trans_x), dim=1))\n        x = x + res\n\n        return x<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\uff08CVPR2022\u7684\u53bb\u566a\u8bba\u6587\uff09 \u521b\u65b0\u70b9\uff1a \u2460\u672c\u6587\u63d0\u51faSwin-Conv\u6a21\u5757\uff0c\u5c06DRUNet\u548cSwinIR\u7684\u7ed3\u5408 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":401,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[14,13,28,11],"_links":{"self":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/397"}],"collection":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/comments?post=397"}],"version-history":[{"count":1,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/397\/revisions"}],"predecessor-version":[{"id":404,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/posts\/397\/revisions\/404"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/media\/401"}],"wp:attachment":[{"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/media?parent=397"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/categories?post=397"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.liguanxin.cn\/index.php\/wp-json\/wp\/v2\/tags?post=397"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}