SRCNN-图像超分辨的学习

本文介绍SRCNN算法,一种基于深度卷积神经网络的单张图像超分辨率增强方法。SRCNN采用轻量级网络结构,实现从低分辨率图像直接输出高分辨率图像,展现先进恢复质量和快速在线使用能力。实验结果显示,SRCNN在PSNR指标上显著优于双三次差值方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

《Learning a Deep Convolutional Network for Image Super-Resolution》的学习

(Learning a Deep Convolutional Network for Image Super-Resolution,ECCV2014)

文章摘要

本文深度学习的方法实现单张图的超分辨,其中深度学习是采用卷积神经网络来实现。这种方法(SRCNN)是一种端到端的作法,输入低分辨率的图像,直接输出高分辨率的图像。本文设计是一种轻量级的神经网络结构,可是它能够实现先进的恢复质量,并且可以快速在线使用。

算法模型

在这里插入图片描述
此图展示了SRCNN的网络结构。
在这里插入图片描述
此图展示了在卷积神经网络下稀疏编码的结构。

SRCNN整个算法包括三个操作:

  1. Patch extraction and representation

F 1 ( Y ) = max ⁡ ( 0 , W 1 ∗ Y + B 1 ) F_{1}(\mathbf{Y})=\max \left(0, W_{1} * \mathbf{Y}+B_{1}\right) F1(Y)=max(0,W1Y+B1)

  1. Non-linear mapping

F 2 ( Y ) = max ⁡ ( 0 , W 2 ∗ F 1 ( Y ) + B 2 ) F_{2}(\mathbf{Y})=\max \left(0, W_{2} * F_{1}(\mathbf{Y})+B_{2}\right) F2(Y)=max(0,W2F1(Y)+B2)

  1. Reconstruction

F ( Y ) = W 3 ∗ F 2 ( Y ) + B 3 F(\mathbf{Y})=W_{3} * F_{2}(\mathbf{Y})+B_{3} F(Y)=W3F2(Y)+B3

在该论文中,利用Relu作为收敛函数,利用最小均方差函数为Loss函数
Loss函数
L ( Θ ) = 1 n ∑ i = 1 n ∥ F ( Y i ; Θ ) − X i ∥ 2 L(\Theta)=\frac{1}{n} \sum_{i=1}^{n}\left\|F\left(\mathbf{Y}_{i} ; \Theta\right)-\mathbf{X}_{i}\right\|^{2} L(Θ)=n1i=1nF(Yi;Θ)Xi2

TensorFlow代码

// 主函数
from model import SRCNN
from utils import input_setup

import numpy as np
import tensorflow as tf

import pprint
import os

flags = tf.app.flags
flags.DEFINE_integer("epoch", 15000, "Number of epoch [15000]")
flags.DEFINE_integer("batch_size", 128, "The size of batch images [128]")
flags.DEFINE_integer("image_size", 33, "The size of image to use [33]")
flags.DEFINE_integer("label_size", 21, "The size of label to produce [21]")
flags.DEFINE_float("learning_rate", 1e-4, "The learning rate of gradient descent algorithm [1e-4]")
flags.DEFINE_integer("c_dim", 1, "Dimension of image color. [1]")
flags.DEFINE_integer("scale", 3, "The size of scale factor for preprocessing input image [3]")
flags.DEFINE_integer("stride", 14, "The size of stride to apply input image [14]")
flags.DEFINE_string("checkpoint_dir", "checkpoint", "Name of checkpoint directory [checkpoint]")
flags.DEFINE_string("sample_dir", "sample", "Name of sample directory [sample]")
flags.DEFINE_boolean("is_train", True, "True for training, False for testing [True]")
FLAGS = flags.FLAGS

pp = pprint.PrettyPrinter()

def main(_):
  pp.pprint(flags.FLAGS.__flags)

  if not os.path.exists(FLAGS.checkpoint_dir):
    os.makedirs(FLAGS.checkpoint_dir)
  if not os.path.exists(FLAGS.sample_dir):
    os.makedirs(FLAGS.sample_dir)

  with tf.Session() as sess:
    srcnn = SRCNN(sess, 
                  image_size=FLAGS.image_size, 
                  label_size=FLAGS.label_size, 
                  batch_size=FLAGS.batch_size,
                  c_dim=FLAGS.c_dim, 
                  checkpoint_dir=FLAGS.checkpoint_dir,
                  sample_dir=FLAGS.sample_dir)

    srcnn.train(FLAGS)
    
if __name__ == '__main__':
  tf.app.run()

Tensorflow完整代码:Tensorflow
MATLAB代码: MATLAB.
Caffe代码:Caffe

结果

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
双三次差值的 : PSNR=26.633759 dB
SRCNN的: PSNR=29.290147 dB
相比两种算法的PSNR,SRCNN有着明显的提升。

SRCNN的不足

  1. 利用Relu作为激活函数虽然速度快,但是训练的时候很”脆弱”,很容易就”die”;
  2. SRCNN需要先通过双三次插值的方法对低分辨率的图片插值放大尺寸。

参考文献
[1]: https://zhuanlan.zhihu.com/p/49846783
[2]: https://medium.com/coinmonks/review-srcnn-super-resolution-3cb3a4f67a7c
[3]: http://jiaqianlee.com/2018/06/09/SRCNN/

### 扣子智能体平台功能与使用说明 #### 平台概述 扣子Coze)是由字节跳动推出的一款面向终端用户的智能体开发平台[^3]。该平台支持用户通过零代码或低代码方式快速构建基于人工智能大模型的各种智能体应用,并能够将其部署至其他网站或者通过 API 集成到现有的系统中。 #### 快速搭建智能体 无论是具备还是缺乏编程基础的用户,都能够借助扣子平台迅速创建一个 AI 智能体。例如,可以参照一篇教程中的实例来学习如何打造一个解决日常生活问题的小助手[^1]。这不仅降低了技术门槛,还使得更多的人有机会参与到智能化工具的设计过程中去。 #### 插件系统的利用 为了进一步增强所建智能体的能力,在其技能配置环节可加入不同类型的插件。一旦添加成功,则可以在编写提示语句的时候直接调用这些插件,亦或是融入自动化流程里实现更复杂操作逻辑的目的[^2]。这种灵活运用外部资源的方法极大地拓宽了单个智能体所能覆盖的应用场景范围。 ```python # 示例:假设我们有一个简单的 Python 脚本用于模拟调用某个插件功能 def call_plugin(plugin_name, parameters): result = f"Plugin {plugin_name} called with params: {parameters}" return result example_call = call_plugin("weather", {"location": "Beijing"}) print(example_call) ``` 上述代码片段仅作为概念展示之用,实际情况下具体实现会依据官方文档指导完成。 #### 总结 综上所述,扣子智能体平台提供了便捷高效的途径让用户无需深厚编码背景即可打造出满足特定需求的AI解决方案;同时它开放性强允许接入第三方服务从而提升整体性能表现。
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值