class_docstr: COCO default teacher that expects open-ended descriptions of images.
class_docstr_tok: ["COCO","default","teacher","that","expects","open-ended","descriptions","of","images","."]
code: def _setup_data(self, test_info_path, annotation_path, opt):
      if self.version == "2014":
          with PathManager.open(annotation_path) as data_file:
              raw_data = json.load(data_file)["images"]
          if "train" in self.datatype:
              self.annotation = [
                  d for d in raw_data if d["split"] == "train"
              ]
              if self.include_rest_val:
                  self.annotation += [
                      d for d in raw_data if d["split"] == "restval"
                  ]
          elif "valid" in self.datatype:
              self.annotation = [
                  d for d in raw_data if d["split"] == "val"
              ]
              self.cands = [
                  l
                  for d in self.annotation
                  for l in [s["raw"] for s in d["sentences"]]
              ]
          else:
              self.annotation = [
                  d for d in raw_data if d["split"] == "test"
              ]
              if self.test_split != -1:
                  start = self.test_split * 1000
                  end = (self.test_split + 1) * 1000
                  self.annotation = self.annotation[start:end]
              self.cands = [
                  l
                  for d in self.annotation
                  for l in [s["raw"] for s in d["sentences"]]
              ]
      else:
          if not self.datatype.startswith("test"):
              print("loading: " + annotation_path)
              with PathManager.open(annotation_path) as data_file:
                  self.annotation = json.load(data_file)["annotations"]
          else:
              print("loading: " + test_info_path)
              with PathManager.open(test_info_path) as data_file:
                  self.test_info = json.load(data_file)
          if not self.datatype.startswith("train"):
              self.cands = load_candidates(
                  opt["datapath"], opt["datatype"], self.version
              )
  
imports: from typing import Optional
  from parlai.core.params import ParlaiParser
  from parlai.core.opt import Opt
  from parlai.core.teachers import FixedDialogTeacher
  from parlai.core.image_featurizers import ImageLoader
  from parlai.utils.io import PathManager
  from .build_2014 import build
  from .build_2014 import buildImage
  from .build_2017 import build
  from .build_2017 import buildImage
  import os
  import json
  import random
label_desc: Use image node_id 10 for calling the DefaultTeacher obj's underlying member method code with example usage: obj._setup_data(test_info_path, annotation_path, opt) without return types