예제 #1
0
label_size = cu_pixel
middle_size = cu_pixel * scale
input_cache = np.zeros([cache_size, cu_size * scale, cu_size * scale])
label_cache = np.zeros([cache_size, cu_size, cu_size])
cache_cnt = 0

####### Configuration ##########
fid = 0
h5er = h5Handler(h5_name)
x_up = math.floor(width / cu_size - 1)
y_up = math.floor(height / cu_size - 1)
####### Configuration ##########
print("Input size: ", input_size)
if not random_flag:
    for i in range(f_cnt):
        Y = read_frame(dec_name, i, height, width)
        YY = read_frame(gt_name, i, height, width)
        cv2.imwrite('dec.png', Y)
        cv2.imwrite('gt.png', YY)
        for lx in range(0, width, cu_size):
            for ly in range(0, height, cu_size):
                rx = lx + cu_size * scale
                ry = ly + cu_size * scale
                if rx >= width or ry >= height:
                    continue
                # import IPython
                # IPython.embed()
                input_cache[cache_cnt, :, :] = Y[ly:ly + cu_size * scale,
                                                 lx:lx + cu_size * scale]

                if mask_mean:
예제 #2
0
        [f_id, y, x, mode] = line.split()
        y = int(y)
        x = int(x)
        f_id = int(f_id)
        mode = int(mode)
        # --------------for debug------------------
        #if f_id > 5:
        #   break
        # --------------for debug------------------

        if y == 0 and x == 0:
            pc = 0
            dc = 0
            ac = 0

            gt_img = read_frame(gt_path, f_id, height, width)
            dec_img = read_frame(dec_path, f_id, height, width)
            print(f_id)
        if x == 0 or y == 0:
            continue
        # print([x, y])
        input[:, :2048, :, :] = dec_img[x - block_size:x,
                                        y - block_size:y + block_size].reshape(
                                            [1, 2048, 1, 1]) / 255.0
        input[:, 2048:, :, :] = dec_img[x:x + block_size,
                                        y - block_size:y].reshape(
                                            [1, 1024, 1, 1]) / 255.0
        label[...] = gt_img[x:x + block_size, y:y + block_size].reshape(
            [1, 1024, 1, 1]) / 255.0
        # test_img[:32,:64] = input[:,:2048,:,:].reshape([32,64])
        # test_img[32:,:32] = input[:,2048:,:,:].reshape([32,32])