File size: 1,152 Bytes
a80d6bb
 
 
 
 
 
 
c74a070
a80d6bb
 
 
 
 
 
 
 
c74a070
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a80d6bb
 
 
c74a070
a80d6bb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import numpy as np


def denorm(img, max_value):
    img = img * float(max_value)
    return img


def preprocess_test_patch(input_image, target_image, gt_image):
    input_patch_list = []
    target_patch_list = []
    gt_patch_list = []
    H = input_image.shape[2]
    W = input_image.shape[3]
    for i in range(3):
        for j in range(3):
            input_patch = input_image[
                :,
                :,
                int(i * H / 3) : int((i + 1) * H / 3),
                int(j * W / 3) : int((j + 1) * W / 3),
            ]
            target_patch = target_image[
                :,
                :,
                int(i * H / 3) : int((i + 1) * H / 3),
                int(j * W / 3) : int((j + 1) * W / 3),
            ]
            gt_patch = gt_image[
                :,
                :,
                int(i * H / 3) : int((i + 1) * H / 3),
                int(j * W / 3) : int((j + 1) * W / 3),
            ]
            input_patch_list.append(input_patch)
            target_patch_list.append(target_patch)
            gt_patch_list.append(gt_patch)

    return input_patch_list, target_patch_list, gt_patch_list