关于tensorboard的一些补充
更改tensorboard的路径:tensorboard --logdir tb_logger/ --port 6008
再通过服务器ip.6008通过电脑本地查看
matlab -nodesktop -nosplash -r matlabfile
python train.py -opt options/train/train_sr.json
接下来看看模糊处理~
deblur
setting
{
"name": "LR_x4_subnet_DIV2K_guan_deblur" // please remove "debug_" during training
, "tb_logger_dir": "sr"
, "use_tb_logger": true
, "model":"sr"
, "scale": 1
, "crop_scale":0
, "gpu_ids": [3,5]
// , "init_type": "kaiming"
//
// , "finetune_type": "sft"
// , "init_norm_type": "zero"
, "datasets": {
"train": {
"name": "DIV2K"
// , "mode": "LQHQ"
// , "dataroot_HR": "/media/sdc/jwhe/BasicSR_v2/data/DIV2K/DIV2K800_sub"
// , "dataroot_HQ": "/media/sdc/jwhe/BasicSR_v2/data/DIV2K/DIV2K800_sub_Gaussian15"
// , "dataroot_LQ": "/media/sdc/jwhe/BasicSR_v2/data/DIV2K/DIV2K800_sub_Gaussian50"
, "mode": "LRHR"
, "dataroot_HR": "/home/guanwp/BasicSR_datasets/DIV2K800_sub"
, "dataroot_LR": "/home/guanwp/BasicSR_datasets/DIV2K800_sub_blur"
, "subset_file": null
, "use_shuffle": true
, "n_workers": 8
, "batch_size": 16//24 // 16
, "HR_size": 128 // 128 | 192 | 96
//, "noise_gt": true///residual
, "use_flip": true
, "use_rot": true
}
//
// , "val": {
// "name": "val_CBSD68_Gaussian50",
// "mode": "LRHR",
// "dataroot_HR": "/home/jwhe/workspace/BasicSR_v3/data/CBSD68/mod2/CBSD68_mod",
// "dataroot_LR": "/home/jwhe/workspace/BasicSR_v3/data/CBSD68/mod2/CBSD68_Gaussian50"
// , "noise_gt": true
// }
// , "val": {
// "name": "val_CBSD68_s08_c03",
// "mode": "LRHR",
// "dataroot_HR": "/home/jwhe/workspace/BasicSR_v3/data/CBSD68/mod2/CBSD68_mod",
// "dataroot_LR": "/home/jwhe/workspace/BasicSR_v3/data/CBSD68/mod2/CBSD68_s08_c03"
// , "noise_gt": true
// }
// , "val": {
// "name": "val_CBSD68_clean",
// "mode": "LRHR",
// "dataroot_HR": "/media/sdc/jwhe/BasicSR_v2/data/CBSD68/mod2/CBSD68_mod",
// "dataroot_LR": "/media/sdc/jwhe/BasicSR_v2/data/CBSD68/mod2/CBSD68_mod"
// }
// , "val": {
// "name": "val_LIVE1_gray_JEPG10",
// "mode": "LRHR",
// "dataroot_HR": "/media/hjw/jwhe/BasicSR_v2/data/val/LIVE1_val/LIVE1_gray_mod",
// "dataroot_LR": "/media/hjw/jwhe/BasicSR_v2/data/val/LIVE1_val/LIVE1_gray_jpg10"
// }
// , "val": {
// "name": "val_LIVE1_JEPG80",
// "mode": "LRHR",
// "dataroot_HR": "/media/hjw/jwhe/BasicSR_v2/data/val/LIVE1_val/LIVE1_mod",
// "dataroot_LR": "/media/hjw/jwhe/BasicSR_v2/data/val/LIVE1_val/LIVE1_jpg80"
// }
// , "val_2": {
// "name": "val_Classic5_gray_JEPG30",
// "mode": "LRHR",
// "dataroot_HR": "/media/sdc/jwhe/BasicSR_v2/data/val/Classic5_val/classic5_mod",
// "dataroot_LR": "/media/sdc/jwhe/BasicSR_v2/data/val/Classic5_val/classic5_jpg30"
// }
// , "val": {
// "name": "val_BSD68_gray_Gaussian50",
// "mode": "LRHR",
// "dataroot_HR": "/media/sdc/jwhe/BasicSR_v2/data/BSD68/mod2/BSD68_mod",
// "dataroot_LR": "/media/sdc/jwhe/BasicSR_v2/data/BSD68/mod2/BSD68_gray_Gaussian50"
// }
// , "val": {
// "name": "val_set5_x4_gray_mod4"
// , "mode": "LRHR"
// , "dataroot_HR": "/media/sdc/jwhe/BasicSR_v2/data/val/Set5_val/mod4/Set5_gray_mod4"
// , "dataroot_LR": "/media/sdc/jwhe/BasicSR_v2/data/val/Set5_val/mod4/Set5_gray_bicx4"
// }
//
// , "val": {
// "name": "val_set5_x4_noise50_mod4",
// "mode": "LRHR",
// "dataroot_HR": "/home/jwhe/workspace/BasicSR_v3/data/val/Set5_val/mod4/Set5_mod4",
// "dataroot_LR": "/home/jwhe/workspace/BasicSR_v3/data/val/Set5_val/mod4/Set5_bicLRx4_noise50_UPx4"
// }
// , "val": {
// "name": "val_set5_x4_c03s08_LR_mod4",
// "mode": "LRHR",
// "dataroot_HR": "/home/jwhe/workspace/BasicSR_v3/data/val/Set5_val/mod4/Set5_mod4",
// "dataroot_LR": "/home/jwhe/workspace/BasicSR_v3/data/val/Set5_val/mod4/Set5_bicLRx4_c03s08"
// }
, "val": {
"name": "val_set5_x4_LR_residual_mod4",
"mode": "LRHR",
"dataroot_HR": "/home/guanwp/BasicSR_datasets/val_set5/Set5",
"dataroot_LR": "/home/guanwp/BasicSR_datasets/val_set5/Set5_blur"
// , "noise_gt": true
}
// , "val": {
// "name": "val_set5_x3_mod6"
// , "mode": "LRHR"
// , "dataroot_HR": "/media/sdc/jwhe/BasicSR_v2/data/val/Set5_val/mod6/Set5_mod6"
// , "dataroot_LR": "/media/sdc/jwhe/BasicSR_v2/data/val/Set5_val/mod6/Set5_bicx3"
// }
// }
//
// , "val": {
// "name": "val_set5_x3_gray_mod6"
// , "mode": "LRHR"
// , "dataroot_HR": "/media/sdc/jwhe/BasicSR_v2/data/val/Set5_val/mod6/Set5_gray_mod6"
// , "dataroot_LR": "/media/sdc/jwhe/BasicSR_v2/data/val/Set5_val/mod6/Set5_gray_bicx3"
// }
}
, "path": {
"root": "/home/guanwp/jingwen/sr"
, "pretrain_model_G": null
// , "pretrain_model_G": "../noise_from15to75/experiments/noise15_subnet/models/34000_G.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/noise_estimation/01_gaussian15_nonorm_denoise_resnet_DIV2K/noise15_904000_subnet_noise15_34000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/noise_estimation/01_gaussian15_nonorm_denoise_resnet_DIV2K/noise15_904000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg_estimation/JPEG80_gray_nonorm_denoise_resnet_DIV2K/jpeg80_964000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG30_gray_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_982000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/50to15_models/gaussian75_nonorm_denoise_resnet_DIV2K/noise_CNA_adaptive_988000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/observation_sr/02_bicx3_first_lrx10_nonorm_srcnn_DIV2K/size_CNA_all_conv_adaptive_1000000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG50_gray_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_958000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/50to15_models/gaussian50_nonorm_denoise_resnet_DIV2K_930000/noise_CNA_adaptive.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG80_gray_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_964000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG80_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_912000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/50to15_models/gaussian90_nonorm_denoise_resnet_DIV2K/noise_CNA_adaptive_870000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/observation_jpeg/JPEG40_nonorm_arcnn_DIV2K/jpg_CNA_all_conv_adaptive_982000.pth"
// , "pretrain_model_G": "../baselines/experiments/01_gaussian15_nonorm_denoise_resnet_DIV2K/models/904000_G.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/observation_sr/01_bicx2_first_lrx10_nonorm_srcnn_DIV2K/size_CNA_all_conv_adaptive_996000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/observation_jpeg/JPEG40_kaiming_lr_change_e5_nonorm_arcnn_DIV2K/jpeg_CNA_all_conv_adaptive_596000.pth"
// , "pretrain_model_G": "../observation_sr/experiments/01_bicx2_first_lrx10_nonorm_srcnn_DIV2K/models/996000_G.pth"
// , "pretrain_model_G": "../observation_sr/experiments/02_bicx3_first_lrx10_nonorm_srcnn_DIV2K/models/1000000_G.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/x4tox3_models/bicx5_nonorm_denoise_resnet_DIV2K/size_CNA_adaptive_794000.pth"
// , "pretrain_model_G": "../baselines/experiments/bicx3_adaptive_ksize3_denoise_resnet_DIV2K/models/606000_G.pth"
// , "pretrain_model_G": "../observation_noise/experiments/noise15_nonorm_arcnn_DIV2K/models/778000_G.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/observation_noise/noise15_nonorm_arcnn_DIV2K/noise_CNA_all_conv_adaptive_778000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG50_gray_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_958000.pth"
// , "pretrain_model_G": "../../BasicSR_v2/baselines_v2/experiments/JPEG40_kaiming_lr_change_e5_nonorm_arcnn_DIV2K/models/596000_G.pth"
// , "pretrain_model_G": "../observation_sr/experiments/bicx3_kaiming_nonorm_srcnn_DIV2K/models/982000_G.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/observation_sr/bicx3_kaiming_nonorm_srcnn_DIV2K/size_CNA_all_conv_adaptive_982000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/x4tox3_models/bicx2_nonorm_denoise_resnet_DIV2K/size_CNA_adaptive_962000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/50to15_models/01_gaussian15_nonorm_denoise_resnet_DIV2K/noise_CNA_adaptive_904000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG40_gray_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_956000.pth"
// , "pretrain_model_G": "../baselines/experiments/bicx3_nonorm_denoise_resnet_DIV2K/models/952000_G.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG20_gray_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_966000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/x4tox3_models/bicx3_nonorm_denoise_resnet_DIV2K/size_CNA_adaptive_952000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG30_gray_nonorm_denoise_resnet_DIV2K/jpeg_CNA_adaptive_982000.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/observation_sr/bicx4_kaiming_nonorm_srcnn_DIV2K/size_CNA_adaptive_982000.pth"
// , "pretrain_model_G": "../observation_sr/experiments/bicx4_kaiming_nonorm_srcnn_DIV2K/models/982000_G.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/jpeg10to40_models/JPEG10_gray_nonorm_denoise_resnet_DIV2K_902000/jpeg_CNA_adaptive.pth"
// , "pretrain_model_G": "../experiments/pretrained_models/x4tox3_models/bicx4_nonorm_denoise_resnet_DIV2K_992000/size_CNA_adaptive.pth"
}
// , "network_G": {
// "which_model_G": "sr_resnet" // RRDB_net | sr_resnet | denoise_resnet
, "norm_type": "adaptive_conv_res"
// , "norm_type": null
// , "mode": "CNA"
// , "nf": 64
// , "nb": 16
// , "in_nc": 3
// , "out_nc": 3
, "gc": 32
// , "group": 1
, "down_scale": 2
, "ada_ksize": 1
, "num_classes": 2
, "fea_norm": "adaptive_conv_res"
, "upsample_norm": "adaptive_conv_res"
// }
//
, "network_G": {
"which_model_G": "noise_subnet" // RRDB_net | sr_resnet | modulate_denoise_resnet |noise_subnet
// , "norm_type": "adaptive_conv_res"
, "norm_type": "batch"
, "mode": "CNA"
, "nf": 64
// , "nb": 16
, "in_nc": 3
, "out_nc": 3
// , "gc": 32
, "group": 1
// , "gate_conv_bias": true
// , "ada_ksize": 1
// , "num_classes": 2
// , "fea_norm": "adaptive_conv_res"
// , "upsample_norm": "adaptive_conv_res"
}
// , "network_G": {
// "which_model_G": "srcnn" // RRDB_net | sr_resnet
, "norm_type": null
// , "norm_type": "adaptive_conv_res"
// , "mode": "CNA"
// , "nf": 64
// , "in_nc": 1
// , "out_nc": 1
// , "ada_ksize": 5
// }
// , "network_G": {
// "which_model_G": "arcnn"
, "norm_type": "adaptive_conv_res"
// , "norm_type": null
// , "mode": "CNA"
// , "nf": 64
// , "in_nc": 1
// , "out_nc": 1
// , "group": 1
, "ada_ksize": 5
// }
, "train": {
// "lr_G": 1e-3
"lr_G": 1e-4
, "lr_scheme": "MultiStepLR"
// , "lr_steps": [200000, 400000, 600000, 800000]
, "lr_steps": [500000]
// , "lr_steps": [600000]
// , "lr_steps": [1000000]
// , "lr_steps": [50000, 100000, 150000, 200000, 250000]
// , "lr_steps": [100000, 200000, 300000, 400000]
, "lr_gamma": 0.1
// , "lr_gamma": 0.5
, "pixel_criterion": "l2_tv"//"l2"
, "pixel_weight": 1.0
, "val_freq": 1e3
, "manual_seed": 0
, "niter": 1e6
// , "niter": 6e5
}
, "logger": {
"print_freq": 200
, "save_checkpoint_freq": 1e3
}
}
network的结果跟之前博文《 基于pytorch的噪声估计网络》一样
deblur的实验结果
从图中对比可得,deblur的效果是比较好的。下面进行blur kernel estimation的实验
blur kernel estimation
添加模糊核
kerneltype = 1; % {1, 2, 3}
%############################### kernel ###################################
% there are tree types of kernels, including isotropic Gaussian,
% anisotropic Gaussian, and estimated kernel k_b for isotropic Gaussian k_d
% under direct downsampler (x2 and x3 only).
if kerneltype == 1
% type 1, isotropic Gaussian---although it is a special case of anisotropic Gaussian.
kernelwidth = 2.6; % from a range of [0.2, 2] for sf = 2, [0.2, 3] for sf = 3, and [0.2, 4] for sf = 4.
kernel = fspecial('gaussian',15, kernelwidth); % Note: the kernel size is fixed to 15X15.
tag = ['_',method,'_x',num2str(sf),'_itrG_',int2str(kernelwidth*10),'_nlevel_',int2str(nlevel)];
elseif kerneltype == 2
% type 2, anisotropic Gaussian
nk = randi(size(net.meta.AtrpGaussianKernel,4)); % randomly select one
kernel = net.meta.AtrpGaussianKernel(:,:,:,nk);
tag = ['_',method,'_x',num2str(sf),'_atrG_',int2str(nk),'_nlevel_',int2str(nlevel)];
elseif kerneltype == 3 && ( sf==2 || sf==3 )
% type 3, estimated kernel k_b (x2 and x3 only)
nk = randi(size(net.meta.directKernel,4)); % randomly select one
kernel = net.meta.directKernel(:,:,:,nk);
tag = ['_',method,'_x',num2str(sf),'_dirG_',int2str(nk),'_nlevel_',int2str(nlevel)];
end
%##########################################################################
python train.py -opt options/train/train_sr.json
先求blurkernel的协方差矩阵,然后将协方差矩阵降维到3维。