code: def do_tta_predict(args, model, ckp_path, tta_num=4):
      """
      return 18000x128x128 np array
      """
      model.eval()
      preds = []
      meta = None
  
      # i is tta index, 0: no change, 1: horizon flip, 2: vertical flip, 3: do both
      for flip_index in range(tta_num):
          print("flip_index:", flip_index)
          test_loader = get_test_loader(
              args.batch_size,
              index=flip_index,
              dev_mode=False,
              pad_mode=args.pad_mode,
          )
          meta = test_loader.meta
          outputs = None
          with torch.no_grad():
              for i, img in enumerate(test_loader):
                  add_depth_channel(img, args.pad_mode)
                  img = img.cuda()
                  output, _ = model(img)
                  output = torch.sigmoid(output)
                  if outputs is None:
                      outputs = output.squeeze()
                  else:
                      outputs = torch.cat(
                          [outputs, output.squeeze()], 0
                      )
  
                  print(
                      "{} / {}".format(
                          args.batch_size * (i + 1), test_loader.num
                      ),
                      end="\r",
                  )
          outputs = outputs.cpu().numpy()
          # flip back masks
          if flip_index == 1:
              outputs = np.flip(outputs, 2)
          elif flip_index == 2:
              outputs = np.flip(outputs, 1)
          elif flip_index == 3:
              outputs = np.flip(outputs, 2)
              outputs = np.flip(outputs, 1)
          # print(outputs.shape)
          preds.append(outputs)
  
      parent_dir = ckp_path + "_out"
      if not os.path.exists(parent_dir):
          os.makedirs(parent_dir)
      np_file = os.path.join(parent_dir, "pred.npy")
  
      model_pred_result = np.mean(preds, 0)
      np.save(np_file, model_pred_result)
  
      return model_pred_result, meta
  
imports: import os
  import glob
  import argparse
  import numpy
  import torch
  import torch.optim
  import torch.nn.functional
  import settings
  from loader import get_test_loader, add_depth_channel
  from models import UNetResNetV4, UNetResNetV5, UNetResNetV6, UNet7, UNet8
  from postprocessing import crop_image, binarize, resize_image
  from metrics import intersection_over_union, intersection_over_union_thresholds
  from utils import create_submission
label_desc: Use image node_id 1 for calling a global function with example usage: do_tta_predict(args, model, ckp_path, tta_num) and returns: model_pred_result,  meta