class_docstr: RefCOCO dataset.
  
  The `Refcoco` and `Refcoco+` dataset is based on
  `ReferItGame: Referring to Objects in Photographs of Natural Scenes
  <http://tamaraberg.com/papers/referit.pdf>`_.
  
  The `Refcocog` dataset is based on
  `Generation and Comprehension of Unambiguous Object Descriptions
  <https://arxiv.org/abs/1511.02283>`_.
  
  Args:
      ann_file (str): Annotation file path.
      data_root (str): The root directory for ``data_prefix`` and
          ``ann_file``. Defaults to ''.
      data_prefix (str): Prefix for training data.
      split_file (str): Split file path.
      split (str): Split name. Defaults to 'train'.
      text_mode (str): Text mode. Defaults to 'random'.
      **kwargs: Other keyword arguments in :class:`BaseDataset`.
class_docstr_tok: ["RefCOCO","dataset",".","The","`","Refcoco","`","and","`","Refcoco+","`","dataset","is","based","on","`","ReferItGame",":","Referring","to","Objects","in","Photographs","of","Natural","Scenes","<","http",":","\/\/tamaraberg.com\/papers\/referit.pdf",">","`","_",".","The","`","Refcocog","`","dataset","is","based","on","`","Generation","and","Comprehension","of","Unambiguous","Object","Descriptions","<","https",":","\/\/arxiv.org\/abs\/1511.02283",">","`","_",".","Args",":","ann_file","(","str",")",":","Annotation","file","path",".","data_root","(","str",")",":","The","root","directory","for","``","data_prefix","``","and","``","ann_file","``",".","Defaults","to","``",".","data_prefix","(","str",")",":","Prefix","for","training","data",".","split_file","(","str",")",":","Split","file","path",".","split","(","str",")",":","Split","name",".","Defaults","to","'train","'",".","text_mode","(","str",")",":","Text","mode",".","Defaults","to","'random","'",".","*","*","kwargs",":","Other","keyword","arguments","in",":","class",":","`","BaseDataset","`","."]
docstr: Initialize the refs for RefCOCO.
docstr_tok: ["Initialize","the","refs","for","RefCOCO","."]
code: def _init_refs(self):
      """Initialize the refs for RefCOCO."""
      anns, imgs = {}, {}
      for ann in self.instances["annotations"]:
          anns[ann["id"]] = ann
      for img in self.instances["images"]:
          imgs[img["id"]] = img
  
      refs, ref_to_ann = {}, {}
      for ref in self.splits:
          # ids
          ref_id = ref["ref_id"]
          ann_id = ref["ann_id"]
          # add mapping related to ref
          refs[ref_id] = ref
          ref_to_ann[ref_id] = anns[ann_id]
  
      self.refs = refs
      self.ref_to_ann = ref_to_ann
  
file_path: mmdetection/mmdet/datasets/refcoco.py
imports: import collections
  import os.path
  import random
  from typing import Dict, List
  import mmengine
  from mmengine.dataset import BaseDataset
  from mmdet.registry import DATASETS
label_desc: Use image node_id 3 for calling the RefCocoDataset obj's underlying member method code with example usage: obj._init_refs() without return types