Beispiel #1
0
def get_standard_result(im_name, sigma):
    for name in os.listdir(standard_result_dir):
        if im_name[:-4] in name and 'sigma_' + str(int(sigma)) + '-' in name:
            if '-1st' in name:
                res_1st = decode_res(name)
            if '-2nd' in name:
                res_2nd = decode_res(name)
    res_1st = float(res_1st['PSNR'])
    res_2nd = float(res_2nd['PSNR'])
    return res_1st, res_2nd
Beispiel #2
0
    for im_name in im_name_list:
        print(im_name)

        standard_list = list()
        bm_noisy_2nd_list = list()
        im_str = im_name[:-4]
        sigma_list = [2, 5, 10, 20, 30, 40, 60, 80, 100]
        for sigma in sigma_list:
            sigma_str = 'sigma_' + str(sigma) + '_'

            psnr1st, psnr2nd = get_standard_result(im_name, sigma)
            standard_list.append(psnr2nd)

            name = find_filename_in_dir(
                search_dir, include_str_list=[im_str, sigma_str, 'BM-noisy'])
            psnr = decode_res(name)['PSNR']
            bm_noisy_2nd_list.append(psnr)

        x_list = sigma_list
        y_list = standard_list
        k_ = ['name', 'x', 'y', 'color', 'linestyle']
        v_ = ['standard', x_list, y_list, 'green', '--']
        line_dict_1 = dict(zip(k_, v_))

        x_list = sigma_list
        y_list = bm_noisy_2nd_list
        v_ = ['2nd_use_noisy_BM', x_list, y_list, 'red', '--']
        line_dict_2 = dict(zip(k_, v_))

        plt = plot_dict_res(line_dict_1,
                            line_dict_2,
Beispiel #3
0
    'nW': [0],
    'NW': [8, 10, 12, 16, 20],
    # 'lamb': np.arange(4, 12),
}

key = 'lamb'
val_list = np.arange(4, 12)

for condition in dict_product(hyper_dict):

    key_psnr_list = list()
    for val in val_list:
        key_condition = {key: val}
        for im_name in os.listdir(search_dir):
            if is_contain_all(im_name, im_na, condition, key_condition):
                kv = decode_res(im_name)
                key_psnr_list.append(kv['psnr'])
    print(condition)
    print(key_psnr_list)

    l1 = plt.plot(val_list, key_psnr_list, 'g--', label='psnr')

    for x, psnr in zip(val_list, key_psnr_list):
        plt.text(x,
                 psnr,
                 'cpp' + '%.3f' % psnr,
                 ha='center',
                 va='top',
                 fontsize=10,
                 color='g')
    plt.rcParams['savefig.dpi'] = 300  # 图片像素