class_docstr: `HD1K <http://hci-benchmark.iwr.uni-heidelberg.de/>`__ dataset for optical flow.
  
  The dataset is expected to have the following structure: ::
  
      root
          hd1k
              hd1k_challenge
                  image_2
              hd1k_flow_gt
                  flow_occ
              hd1k_input
                  image_2
  
  Args:
      root (string): Root directory of the HD1K Dataset.
      split (string, optional): The dataset split, either "train" (default) or "test"
      transforms (callable, optional): A function/transform that takes in
          ``img1, img2, flow, valid_flow_mask`` and returns a transformed version.
class_docstr_tok: ["`","HD1K","<","http",":","\/\/hci-benchmark.iwr.uni-heidelberg.de\/",">","`","__","dataset","for","optical","flow",".","The","dataset","is","expected","to","have","the","following","structure",":",":",":","root","hd1k","hd1k_challenge","image_2","hd1k_flow_gt","flow_occ","hd1k_input","image_2","Args",":","root","(","string",")",":","Root","directory","of","the","HD1K","Dataset",".","split","(","string",",","optional",")",":","The","dataset","split",",","either","``","train","''","(","default",")","or","``","test","''","transforms","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","``","img1",",","img2",",","flow",",","valid_flow_mask","``","and","returns","a","transformed","version","."]
code: def __init__(
      self,
      root: str,
      split: str = "train",
      transforms: Optional[Callable] = None,
  ) -> None:
      super().__init__(root=root, transforms=transforms)
  
      verify_str_arg(split, "split", valid_values=("train", "test"))
  
      root = Path(root) / "hd1k"
      if split == "train":
          # There are 36 "sequences" and we don't want seq i to overlap with seq i + 1, so we need this for loop
          for seq_idx in range(36):
              flows = sorted(
                  glob(
                      str(
                          root
                          / "hd1k_flow_gt"
                          / "flow_occ"
                          / f"{seq_idx:06d}_*.png"
                      )
                  )
              )
              images = sorted(
                  glob(
                      str(
                          root
                          / "hd1k_input"
                          / "image_2"
                          / f"{seq_idx:06d}_*.png"
                      )
                  )
              )
              for i in range(len(flows) - 1):
                  self._flow_list += [flows[i]]
                  self._image_list += [[images[i], images[i + 1]]]
      else:
          images1 = sorted(
              glob(str(root / "hd1k_challenge" / "image_2" / "*10.png"))
          )
          images2 = sorted(
              glob(str(root / "hd1k_challenge" / "image_2" / "*11.png"))
          )
          for image1, image2 in zip(images1, images2):
              self._image_list += [[image1, image2]]
  
      if not self._image_list:
          raise FileNotFoundError(
              "Could not find the HD1K images. Please make sure the directory structure is correct."
          )
  
imports: import itertools
  import os
  from abc import ABC, abstractmethod
  from glob import glob
  from pathlib import Path
  from typing import Callable, List, Optional, Tuple, Union
  import numpy
  import torch
  from PIL import Image
  from ..io.image import _read_png_16
  from .utils import _read_pfm, verify_str_arg
  from .vision import VisionDataset
label_desc: Use image node_id 1 to create a new HD1K object from inherited base classes: FlowDataset with example: obj = HD1K(root, split, transforms)