论文阅读(一)—— Deep Image Prior,CVPR2018

Deep Image Prior是发表于CVPR2018,文章介绍了直接利用随机初始化的深度卷积(生成)网络来进行图像去噪,修补,超分辨率等图像逆向工程。

作者认为不需要从大量的图像中来学习图像的先验信息,就能做到图像修复等,也就是直接把卷积生成网络看成一般的待优化函数,直接进行梯度优化,而不是基于大量的图像学习,文章的原话是:we cast reconstruction as a conditional image generation problem and show that the only information required to solve it is contained in the single degraded input image and the handcrafted structure of the network used for reconstruction. No aspect of the network is learned from data;the weights of the network are always randomly initialized, so that the only prior information is in the structure of the network itself.
在这里插入图片描述

文章的方法流程如下:
  1. 对于一幅待修复的图像x0
### Deep Image Prior 技术概述 Deep Image Prior种利用神经网络结构本身作为正则化先验的方法,用于图像恢复任务。这种方法的核心思想在于通过训练个随机初始化的卷积神经网络来拟合目标图像,而不需要额外的数据集或预训练模型[^3]。 #### 工作原理 Deep Image Prior 的核心机制依赖于这样个观察:即使是在完全随机初始化的情况下,深层神经网络也能够隐含地表达复杂的图像结构特性。具体来说,在优化过程中,仅通过对输入噪声向量的学习即可重建高质量的目标图像。这种现象表明,神经网络架构本身就具有强大的归纳偏置能力,可以充当有效的图像先验。 以下是其实现的关键步骤: 1. **定义生成器网络** 使用个标准的全连接层或者卷积神经网络作为生成器 \( G \),该网络接受随机噪声向量 \( z \) 作为输入,并输出张合成图像 \( I_{synthetic} \)[^4]。 2. **损失函数设计** 定义个适合特定任务的损失函数 \( L(I_{synthetic}, I_{target}) \),其中 \( I_{target} \) 表示目标图像。常见的损失形式包括像素级均方误差 (MSE) 或感知损失 (Perceptual Loss)[^5]。 3. **参数更新策略** 只有生成器中的权重被调整,而不涉及任何外部数据驱动的过程。这使得整个算法能够在单张图片上运行并快速收敛到合理的结果[^6]。 #### 实现代码示例 下面提供了个简单的 PyTorch 版本实现框架供参考: ```python import torch from torchvision import transforms from PIL import Image class Generator(torch.nn.Module): def __init__(self): super(Generator, self).__init__() # Define your generator architecture here. def forward(self, x): pass # Implement the forward propagation logic. def deep_image_prior(target_img_path, num_iterations=5000): device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') transform = transforms.Compose([ transforms.ToTensor(), ]) target_img = Image.open(target_img_path).convert("RGB") target_tensor = transform(target_img).unsqueeze(0).to(device) gen_input = torch.randn((1, latent_dim, height, width)).to(device) model = Generator().to(device) optimizer = torch.optim.Adam(model.parameters(), lr=0.01) for i in range(num_iterations): synthetic_output = model(gen_input) loss = ((synthetic_output - target_tensor)**2).mean() optimizer.zero_grad() loss.backward() optimizer.step() if i % 500 == 0: print(f"Iteration {i}: Loss={loss.item()}") if __name__ == "__main__": deep_image_prior("./path_to_target_image.jpg", num_iterations=5000) ``` 上述代码片段展示了如何构建基本的生成器以及执行迭代优化过程以匹配给定的目标图像。 --- ###
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值