docstr: vis_root (string): Root directory of images (e.g. coco/images/)
  ann_root (string): directory to store the annotation file
docstr_tok: ["vis_root","(","string",")",":","Root","directory","of","images","(","e.g",".","coco\/images\/",")","ann_root","(","string",")",":","directory","to","store","the","annotation","file"]
code: def __init__(
      self,
      vis_processor=None,
      text_processor=None,
      vis_root=None,
      ann_paths=[],
  ):
      """
      vis_root (string): Root directory of images (e.g. coco/images/)
      ann_root (string): directory to store the annotation file
      """
      self.vis_root = vis_root
      self.annotation = []
      for ann_path in ann_paths:
          if any(ext in ann_path for ext in ["csv", "tsv"]):
              df = pd.read_csv(ann_path)
              self.annotation.extend(df.to_dict(orient="records"))
  
          elif "jsonl" in ann_path:
              with open(ann_path, "r") as f:
                  self.annotation.extend(
                      [json.loads(line) for line in f]
                  )
  
          else:
              with open(ann_path, "r") as f:
                  loaded = json.load(f)
                  if isinstance(loaded, list):
                      self.annotation.extend(loaded)
                  elif isinstance(loaded, dict):
                      self.annotation.extend(
                          [
                              {"sample_id": k, **v}
                              if isinstance(v, dict)
                              else {"sample_id": k, "data": v}
                              for k, v in loaded.items()
                          ]
                      )
  
      self.vis_processor = vis_processor
      self.text_processor = text_processor
  
      self._add_instance_ids()
  
file_path: lavis/lavis/datasets/datasets/base_dataset.py
imports: import json
  from typing import Iterable
  import pandas
  import torch
  from torch.utils.data import Dataset, ConcatDataset
  from torch.utils.data.dataloader import default_collate
label_desc: Use image node_id 1 to create a new BaseDataset object from inherited base classes: Dataset with example: obj = BaseDataset(vis_processor, text_processor, vis_root, ann_paths)