def METHOD_NAME(self, directory, idx):
    if self.image_modality == "rgb":
        return [Image.open(os.path.join(directory, self.imagefile_template.format(idx))).convert("RGB")]
    elif self.image_modality == "flow":
        idx = math.ceil(idx / 2) - 1 if idx > 2 else 1
        u_img = Image.open(os.path.join(directory, "u", self.imagefile_template.format(idx))).convert("L")
        v_img = Image.open(os.path.join(directory, "v", self.imagefile_template.format(idx))).convert("L")
        return [u_img, v_img]
    else:
        raise RuntimeError("Input modality is not in [rgb, flow, joint]. Current is {}".format(self.image_modality))