class_docstr: The VinVL dataset is a dataset that augments an existing
  dataset within MMF. VinVL requires unique inputs for
  finetuning and pretraining unsupported by general datasets.
  To enable this functionality on arbitrary datasets,
  the VinVL dataset contains a base dataset,
  and returns an augmented version of samples from the
  base dataset.
  
  For example, the VQA2 dataset may return a sample {image, text}
  The VinVL dataset when asked for a sample, will return
  {image, text', rand_caption, rand_label}
      text' = text + labels
      rand_caption = text from a random example
      rand_label = obj detection labels text for a random example
  
  Why does this exist?
  VinVL samples contain rand_caption, and rand_label which require
  random choice from the annotations db, and features_db.
  Currently general text_processors do not have access to these
  databases, instead randomness like mismatched_captions in
  masked coco are implemented on the dataset level.
  To support VinVL finetuning and pretraining on general datasets,
  without a major refactor, the VinVL builder and dataset introduce
  a new design pattern to enable processor access to databases.
  
  Interface and Assumptions:
  The VinVL dataset assumes:
  The sample returned by the base dataset contains a key "text"
  with string text.
  There exists a label_map json file path in the dataset config
  for a json obj containing idx_to_attribute and idx_to_label
  maps. VinVL OD uses VG labels, and this map can be downloaded
  from https://penzhanwu2.blob.core.windows.net/sgg/
  sgg_benchmark/vinvl_model_zoo/VG-SGG-dicts-vgoi6-clipped.json
  The features_db points to features generated from the VinVL
  feature extraction script, consult the VinVL feature
  extraction tutorial for more details.
class_docstr_tok: ["The","VinVL","dataset","is","a","dataset","that","augments","an","existing","dataset","within","MMF",".","VinVL","requires","unique","inputs","for","finetuning","and","pretraining","unsupported","by","general","datasets",".","To","enable","this","functionality","on","arbitrary","datasets",",","the","VinVL","dataset","contains","a","base","dataset",",","and","returns","an","augmented","version","of","samples","from","the","base","dataset",".","For","example",",","the","VQA2","dataset","may","return","a","sample","{","image",",","text","}","The","VinVL","dataset","when","asked","for","a","sample",",","will","return","{","image",",","text","'",",","rand_caption",",","rand_label","}","text","'","=","text","+","labels","rand_caption","=","text","from","a","random","example","rand_label","=","obj","detection","labels","text","for","a","random","example","Why","does","this","exist","?","VinVL","samples","contain","rand_caption",",","and","rand_label","which","require","random","choice","from","the","annotations","db",",","and","features_db",".","Currently","general","text_processors","do","not","have","access","to","these","databases",",","instead","randomness","like","mismatched_captions","in","masked","coco","are","implemented","on","the","dataset","level",".","To","support","VinVL","finetuning","and","pretraining","on","general","datasets",",","without","a","major","refactor",",","the","VinVL","builder","and","dataset","introduce","a","new","design","pattern","to","enable","processor","access","to","databases",".","Interface","and","Assumptions",":","The","VinVL","dataset","assumes",":","The","sample","returned","by","the","base","dataset","contains","a","key","``","text","''","with","string","text",".","There","exists","a","label_map","json","file","path","in","the","dataset","config","for","a","json","obj","containing","idx_to_attribute","and","idx_to_label","maps",".","VinVL","OD","uses","VG","labels",",","and","this","map","can","be","downloaded","from","https",":","\/\/penzhanwu2.blob.core.windows.net\/sgg\/","sgg_benchmark\/vinvl_model_zoo\/VG-SGG-dicts-vgoi6-clipped.json","The","features_db","points","to","features","generated","from","the","VinVL","feature","extraction","script",",","consult","the","VinVL","feature","extraction","tutorial","for","more","details","."]
code: def __len__(self):
      return len(self.annotation_db)
  
file_path: mmf/mmf/datasets/builders/vinvl/dataset.py
imports: import json
  import logging
  import random
  from mmf.datasets.mmf_dataset import MMFDataset
label_desc: Use image node_id 4 for calling the VinVLDataset obj's underlying member method code with example usage: obj.__len__() and returns: len