Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
deng a1c15f85fe | 1 year ago | |
---|---|---|
ascend310_infer | 2 years ago | |
script | 2 years ago | |
src | 2 years ago | |
README.md | 1 year ago | |
eval.py | 2 years ago | |
export.py | 2 years ago | |
postprocess.py | 2 years ago | |
preprocess.py | 2 years ago | |
train.py | 2 years ago |
目录
EDSR是2017年提出的32层深度网络,在2017年图像恢复和增强的新趋势研讨会上的超分挑战(NTIRE2017 Super-Resolution Challenge)中获得第一名。 EDSR,相比于SRResNet减少了每个残差块中的batch normalization层,SRResNet相对于原本的ResNet则在每个残差块的出口减去了ReLU层.
论文:Bee Lim, Sanghyun Son, Heewon Kim, Seungjun Nah, and Kyoung Mu Lee, "Enhanced Deep Residual Networks for Single Image Super-Resolution," *2nd NTIRE: New Trends in Image Restoration and Enhancement workshop and challenge on image super-resolution in conjunction with CVPR 2017.
EDSR先经过1次卷积层,再串联32个残差模块,再经过1次卷积层,最后上采样并卷积。
使用的数据集:DIV2K
数据集大小:7.11G,
数据格式:png文件
DIV2K
├── DIV2K_test_LR_bicubic
│ ├── X2
│ │ ├── 0901x2.png
│ │ ├─ ...
│ │ └── 1000x2.png
│ ├── X3
│ │ ├── 0901x3.png
│ │ ├─ ...
│ │ └── 1000x3.png
│ └── X4
│ ├── 0901x4.png
│ ├─ ...
│ └── 1000x4.png
├── DIV2K_test_LR_unknown
│ ├── X2
│ │ ├── 0901x2.png
│ │ ├─ ...
│ │ └── 1000x2.png
│ ├── X3
│ │ ├── 0901x3.png
│ │ ├─ ...
│ │ └── 1000x3.png
│ └── X4
│ ├── 0901x4.png
│ ├─ ...
│ └── 1000x4.png
├── DIV2K_train_HR
│ ├── 0001.png
│ ├─ ...
│ └── 0900.png
├── DIV2K_train_LR_bicubic
│ ├── X2
│ │ ├── 0001x2.png
│ │ ├─ ...
│ │ └── 0900x2.png
│ ├── X3
│ │ ├── 0001x3.png
│ │ ├─ ...
│ │ └── 0900x3.png
│ └── X4
│ ├── 0001x4.png
│ ├─ ...
│ └── 0900x4.png
└── DIV2K_train_LR_unknown
├── X2
│ ├── 0001x2.png
│ ├─ ...
│ └── 0900x2.png
├── X3
│ ├── 0001x3.png
│ ├─ ...
│ └── 0900x3.png
└── X4
├── 0001x4.png
├─ ...
└── 0900x4.png
通过官方网站安装MindSpore后,您可以按照如下步骤进行训练和评估:
#单卡训练
sh run_ascend_standalone.sh [TRAIN_DATA_DIR]
#分布式训练
sh run_ascend_distribute.sh [RANK_TABLE_FILE] [TRAIN_DATA_DIR]
#评估
sh run_eval.sh [TEST_DATA_DIR] [CHECKPOINT_PATH] [DATASET_TYPE]
├── model_zoo
├── EDSR
├── README_CN.md //自述文件
├── eval.py //评估脚本
├── export.py //导出脚本
├── script
│ ├── run_ascend_distribute.sh //Ascend分布式训练shell脚本
│ ├── run_ascend_standalone.sh //Ascend单卡训练shell脚本
│ └── run_eval.sh //eval验证shell脚本
├── src
│ ├── args.py //超参数
│ ├── common.py //公共网络模块
│ ├── data
│ │ ├── common.py //公共数据集
│ │ ├── div2k.py //div2k数据集
│ │ └── srdata.py //所有数据集
│ ├── metrics.py //PSNR和SSIM计算器
│ ├── model.py //EDSR网络
│ └── utils.py //训练脚本
└── train.py //训练脚本
主要参数如下:
-h, --help show this help message and exit
--dir_data DIR_DATA dataset directory
--data_train DATA_TRAIN
train dataset name
--data_test DATA_TEST
test dataset name
--data_range DATA_RANGE
train/test data range
--ext EXT dataset file extension
--scale SCALE super resolution scale
--patch_size PATCH_SIZE
output patch size
--rgb_range RGB_RANGE
maximum value of RGB
--n_colors N_COLORS number of color channels to use
--no_augment do not use data augmentation
--model MODEL model name
--n_resblocks N_RESBLOCKS
number of residual blocks
--n_feats N_FEATS number of feature maps
--res_scale RES_SCALE
residual scaling
--test_every TEST_EVERY
do test per every N batches
--epochs EPOCHS number of epochs to train
--batch_size BATCH_SIZE
input batch size for training
--test_only set this option to test the model
--lr LR learning rate
--ckpt_save_path CKPT_SAVE_PATH
path to save ckpt
--ckpt_save_interval CKPT_SAVE_INTERVAL
save ckpt frequency, unit is epoch
--ckpt_save_max CKPT_SAVE_MAX
max number of saved ckpt
--ckpt_path CKPT_PATH
path of saved ckpt
--task_id TASK_ID
Ascend处理器环境运行
sh run_ascend_standalone.sh [TRAIN_DATA_DIR]
如果数据集保存路径为G:\DIV2K,TRAIN_DATA_DIR
应传入G:\。
上述python命令将在后台运行,您可以通过train.log文件查看结果。
Ascend处理器环境运行
sh run_ascend_distribute.sh [RANK_TABLE_FILE] [TRAIN_DATA_DIR]
如果数据集保存路径为G:\DIV2K,TRAIN_DATA_DIR
应传入G:\。
分布式训练需要提前创建JSON格式的HCCL配置文件。具体操作,参见:https://gitee.com/mindspore/mindspore/tree/master/model_zoo/utils/hccl_tools
在运行以下命令之前,请检查用于评估的检查点路径。
sh run_eval.sh [TEST_DATA_DIR] [CHECKPOINT_PATH] [DATASET_TYPE]
DATASET_TYPE
可选 ["Set5", "Set14", "B100", "Urban100", "DIV2K"]
如果数据集保存路径为G:\DIV2K或者G:\Set5或者G:\Set14或者G:\B100或者G:\Urban100,TRAIN_DATA_DIR
应传入G:\。
您可以通过log.txt文件查看结果。
bash run_infer_310.sh [MINDIR_PATH] [DATA_PATH] [DATASET_TYPE] [SCALE] [DEVICE_ID]
DATASET_TYPE
可选 ["Set5", "Set14", "B100", "Urban100"]
SCALE
超分辨率比例可选 ["2", "3", "4"]
DEVICE_ID
设备ID, 默认为:0
您可以通过通过run_infer.log
文件查看结果。
用法:python export.py [--batch_size] [--ckpt_path] [--file_format]
选项:
--batch_size 输入张量的批次大小。
--ckpt_path 检查点路径。
--file_format 可选 ['MINDIR', 'AIR', 'ONNX'], 默认['MINDIR']。
参数 | Ascend |
---|---|
资源 | Ascend 910 |
上传日期 | 2021-7-4 |
MindSpore版本 | 1.2.0 |
数据集 | DIV2K |
训练参数 | epoch=1000, steps=1000, batch_size =16, lr=0.0001 |
优化器 | Adam |
损失函数 | L1 |
输出 | 超分辨率图片 |
损失 | 3.1 |
速度 | 8卡:50.75毫秒/步 |
总时长 | 8卡:12.865小时 |
微调检查点 | 466.13 MB (.ckpt文件) |
脚本 | EDSR |
参数 | Ascend |
---|---|
资源 | Ascend 910 |
上传日期 | 2021-7-4 |
MindSpore版本 | 1.2.0 |
数据集 | Set5,Set14,B100,Urban100 |
batch_size | 1 |
输出 | 超分辨率图片 |
PSNR | Set5:38.2136, Set14:34.0081, B100:32.3590, Urban100:33.0162 |
参数 | Ascend |
---|---|
资源 | Ascend 310 |
上传日期 | 2021-09-29 |
MindSpore版本 | 1.4.0 |
数据集 | Set5,Set14,B100,Urban100 |
batch_size | 1 |
输出 | 超分辨率图片 |
准确率 | Set5:36.6097, Set14:32.8340, B100:30.6077, Urban100:32.3699 |
在train.py中,我们设置了“train_net”函数内的种子。
请浏览官网主页。
EDSR是2017年提出的32层深度网络,在2017年图像恢复和增强的新趋势研讨会上的超分挑战(NTIRE2017 Super-Resolution Challenge)中获得第一名。EDSR,相比于SRResNet减少了每个残差块中的batch normalization层,SRResNet相对于原本的ResNet则在每个残差块的出口减去了ReLU层。
Python C++ Shell Text
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》