裁剪
h, w = image[0].shape[:2] #h=384,w=512
h_max, w_max = self.opts['crop_preproc']#h_max=256,w_max=448需要裁剪的尺寸
max_y_offset, max_x_offset = h - h_max, w - w_max##max_y_offset=128,max_x_offset=64
if max_y_offset > 0 or max_x_offset > 0:
y_offset = np.random.randint(max_y_offset + 1)##98
x_offset = np.random.randint(max_x_offset + 1)##60
# The following assumes the image pair is in [2,H,W,3] format
image = image[:, y_offset:y_offset + h_max, x_offset:x_offset + w_max, :]##(2, 256, 448, 3)
label = label[y_offset:y_offset + h_max, x_offset:x_offset + w_max, :]#(256, 448, 2)
y_offset:y_offset + h_max, x_offset:x_offset + w_max
就是这句话进行的裁剪操作,