Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
MaskedDenoising_pytorch
Commits
4a3cbf1d
"vscode:/vscode.git/clone" did not exist on "ea90f0c118fd39d93a1ac740a99094687f1e243a"
Commit
4a3cbf1d
authored
Jul 09, 2024
by
Rayyyyy
Browse files
Add icon and SCNet
parent
2c461b5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
38 deletions
+24
-38
README.md
README.md
+24
-38
icon.png
icon.png
+0
-0
No files found.
README.md
View file @
4a3cbf1d
# MaskedDenoising
# MaskedDenoising
## 论文
## 论文
[
Masked Image Training for Generalizable Deep Image Denoising
](
https://arxiv.org/abs/2303.13132
)
`Masked Image Training for Generalizable Deep Image Denoising`
-
https://arxiv.org/abs/2303.13132
## 模型结构
## 模型结构
本文对模型修改较小,主要基于SwinIR模型结构增加了
`input mask`
和
`attention masks`
。
本文对模型修改较小,主要基于SwinIR模型结构增加了input mask 和 attention masks。
<div
align=
center
>
<div
align=
center
>
<img
src=
"./doc/method.jpg"
/>
<img
src=
"./doc/method.jpg"
/>
</div>
</div>
## 算法原理
## 算法原理
传统的去噪模型是靠识别噪声本身来起去噪作用的,而不是真正理解图像内容模型。本文的模型在特征提取之后,会对输入图像进行随机大比例遮盖(input mask),比如遮盖75%~85%的像素,迫使网络学习重构被遮盖的内容,增强对图像本身分布的建模能力。遮挡训练的方法可以使模型学习理解和重构图像的内容,而不仅仅依赖于噪声特征,从而获得更好的泛化能力。
传统的去噪模型是靠识别噪声本身来起去噪作用的,而不是真正理解图像内容模型。本文的模型在特征提取之后,会对输入图像进行随机大比例遮盖(input mask),比如遮盖75%~85%的像素,迫使网络学习重构被遮盖的内容,增强对图像本身分布的建模能力。遮挡训练的方法可以使模型学习理解和重构图像的内容,而不仅仅依赖于噪声特征,从而获得更好的泛化能力。
<div
align=
center
>
<div
align=
center
>
...
@@ -21,7 +20,6 @@
...
@@ -21,7 +20,6 @@
## 环境配置
## 环境配置
### Docker(方法一)
### Docker(方法一)
-v 路径、docker_name和imageID根据实际情况修改
-v 路径、docker_name和imageID根据实际情况修改
```
image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk-23.04.1-py38-latest
```
image.sourcefind.cn:5000/dcu/admin/base/pytorch:1.13.1-centos7.6-dtk-23.04.1-py38-latest
...
@@ -33,7 +31,6 @@ pip install -r requirement.txt
...
@@ -33,7 +31,6 @@ pip install -r requirement.txt
```
```
### Dockerfile(方法二)
### Dockerfile(方法二)
-v 路径、docker_name和imageID根据实际情况修改
-v 路径、docker_name和imageID根据实际情况修改
```
```
...
@@ -47,7 +44,6 @@ pip install -r requirement.txt
...
@@ -47,7 +44,6 @@ pip install -r requirement.txt
```
```
### Anaconda(方法三)
### Anaconda(方法三)
1、关于本项目DCU显卡所需的特殊深度学习库可从光合开发者社区下载安装: https://developer.hpccube.com/tool/
1、关于本项目DCU显卡所需的特殊深度学习库可从光合开发者社区下载安装: https://developer.hpccube.com/tool/
```
```
...
@@ -66,27 +62,22 @@ pip install -r requirement.txt
...
@@ -66,27 +62,22 @@ pip install -r requirement.txt
```
```
## 数据集
## 数据集
数据集下载地址:
[
SCNet AIDatasets
](
http://113.200.138.88:18080/aidatasets
)
,将待训练数据
`Train400/DIV2K/Flickr2K`
放入
`trainset`
文件夹中
将待训练数据Train400/DIV2K/Flickr2K放入 trainset 文件夹中
[
Train400
](
https://github.com/cszn/DnCNN/tree/master/TrainingCodes/DnCNN_TrainingCodes_v1.0/data
)
Train400:https://github.com/cszn/DnCNN/tree/master/TrainingCodes/DnCNN_TrainingCodes_v1.0/data
DIV2K官方地址:https://data.vision.ee.ethz.ch/cvl/DIV2K/
[
Train Data (HR images)
](
http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_HR.zip
)
如果官方地址无法下载,可以选择AiStudio公开数据集里的DIV2K下载DIV2K_train_HR.zip:
http
s
://
aistudio.baidu.com/aistudio/datasetdetail/104667
[
Train Data (HR images)
](
http://
113.200.138.88:18080/aidatasets/project-dependency/div2k/-/blob/master/DIV2K_train_HR.zip
)
Flickr2K
:
http
s
://
cv.snu.ac.kr/research/EDSR
/Flickr2K.tar
[
Flickr2K
](
http://
113.200.138.88:18080/aidatasets/project-dependency/flickr2k/-/blob/master
/Flickr2K.tar
)
数据整理完成后,保存在trainset文件夹下,执行gen_data.py获得预处理图像文件夹
trainsets/trainH。
数据整理完成后,保存在
`
trainset
`
文件夹下,执行
`
gen_data.py
`
获得预处理图像文件夹
`
trainsets/trainH
`
。
```
```
gen_data.py
python
gen_data.py
```
```
测试数据集(已在项目中预置):BSD68、CBSD68、Kodak24、McMaster
测试数据集(已在项目中预置):BSD68、CBSD68、Kodak24、McMaster
https://github.com/cszn/FFDNet/tree/master/testsets
-
https://github.com/cszn/FFDNet/tree/master/testsets
数据集的目录结构如下:
数据集的目录结构如下:
...
@@ -105,45 +96,42 @@ https://github.com/cszn/FFDNet/tree/master/testsets
...
@@ -105,45 +96,42 @@ https://github.com/cszn/FFDNet/tree/master/testsets
```
```
## 训练
## 训练
修改配置文件
`options/masked_denoising/input_mask_80_90.json`
中参数为实际训练数据,主要参数如下:
修改配置文件 options/masked_denoising/input_mask_80_90.json 中参数为实际训练数据,主要参数如下:
"gpu_ids": [0,1,2,3] 训练的卡号
"gpu_ids": [0,1,2,3] 训练的卡号
"dataroot_H": "trainsets/trainH" 数据地址
"dataroot_H": "trainsets/trainH" 数据地址
input mask: 设置 "if_mask"和"mask1"
,
"mask2"(line 32-34)
,
制作比例将在mask1和mask2之间随机采样。
input mask: 设置 "if_mask"和"mask1"
,
"mask2"(line 32-34)
,
制作比例将在mask1和mask2之间随机采样。
attention mask: 设置 "use_mask" 和 "mask_ratio1"
,
"mask_ratio2" (line 68-70)
.
attention mask ratio
可以是一个范围或者一个固定值。
attention mask: 设置 "use_mask" 和 "mask_ratio1"
,
"mask_ratio2" (line 68-70)
,
`
attention mask ratio
`
可以是一个范围或者一个固定值。
### 单机多卡
### 单机多卡
#### 普通训练
#### 普通训练
```
```
bash
bash train.sh
bash train.sh
```
```
#### 分布式训练
#### 分布式训练
```
```
bash
bash train_multi.sh
bash train_multi.sh
```
```
## 推理
## 推理
如需使用自己的模型,请修改:
如需使用自己的模型,请修改:
--model_path 训练模型地址
`
--model_path
`
训练模型地址
--opt 训练模型对应的json文件
`
--opt
`
训练模型对应的json文件
--name 结果保存路径results/{name}
`
--name
`
结果保存路径
`
results/{name}
`
#### 单卡推理
#### 单卡推理
```
bash
```
bash test.sh
bash test.sh
```
```
## result
## result
本地测试集测试结果单张展示:
本地测试集测试结果单张展示:
<div
align=
center
>
<div
align=
center
>
...
@@ -155,14 +143,12 @@ bash test.sh
...
@@ -155,14 +143,12 @@ bash test.sh
</div>
</div>
### 精度
### 精度
基于项目提供的测试数据,得到单卡测试结果如下:
基于项目提供的测试数据,得到单卡测试结果如下:
|
| PSNR | SSIM | LPIPS
|
|
DEVICE
| PSNR | SSIM | LPIPS |
| :------: | :------: | :------: | :------: |
| :------: | :------: | :------: | :------: |
| ours | 29.04 | 0.7615 | 0.1294 |
| Z100L | 29.04 | 0.7615 | 0.1294 |
| paper | 30.13 | 0.7981 | 0.1031 |
| V100S | 30.13 | 0.7981 | 0.1031 |
## 应用场景
## 应用场景
### 算法类别
### 算法类别
...
@@ -172,7 +158,7 @@ bash test.sh
...
@@ -172,7 +158,7 @@ bash test.sh
交通,公安,制造
交通,公安,制造
## 源码仓库及问题反馈
## 源码仓库及问题反馈
http://developer.hpccube.com/codes/modelzoo/maskeddenoising_pytorch.git
-
http://developer.hpccube.com/codes/modelzoo/maskeddenoising_pytorch.git
## 参考资料
## 参考资料
https://github.com/haoyuc/MaskedDenoising.git
-
https://github.com/haoyuc/MaskedDenoising.git
icon.png
0 → 100644
View file @
4a3cbf1d
71.8 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment