def compute_flow()

in flow.py [0:0]


    def compute_flow(self, index_pairs, checkpoint):
        """Run Flownet2 with specific <checkpoint> (FlowNet2 or finetuned on KITTI)
        Note that we don't fit homography first for FlowNet2-KITTI model.
        """
        model_name = checkpoint.lower()
        if model_name == "flownet2-kitti":
            model_file = get_model_from_url(
                "https://www.dropbox.com/s/mme80czrpbqal7k/flownet2-kitti.pth.tar?dl=1",
                model_name + ".pth",
            )
        else:
            model_file = f"checkpoints/{model_name}.pth"

        mkdir_ifnotexists("%s/flow" % self.path)

        if self.check_flow_files(index_pairs):
            return

        frame_dir = "%s/color_flow" % self.path
        frame1_fns = [
            "%s/frame_%06d.png" % (frame_dir, pair[0]) for pair in index_pairs
        ]
        frame2_fns = [
            "%s/frame_%06d.png" % (frame_dir, pair[1]) for pair in index_pairs
        ]
        out_fns = [
            "%s/flow/flow_%06d_%06d.raw" % (self.path, i, j)
            for (i, j) in index_pairs
        ]

        tmp = image_io.load_raw_float32_image(
            pjoin(self.path, "color_down", "frame_{:06d}.raw".format(0))
        )
        size = tmp.shape[:2][::-1]
        print("Resizing flow to", size)

        args = dotdict()
        args.pretrained_model_flownet2 = model_file
        args.im1 = list(frame1_fns)
        args.im2 = list(frame2_fns)
        args.out = list(out_fns)
        args.size = size
        args.fp16 = False
        args.homography = 'KITTI' not in checkpoint
        args.rgb_max = 255.0
        args.visualize = False

        optical_flow_flownet2_homography.process(args)

        self.check_flow_files(index_pairs)