old_contents: from models import Image, Object, Attribute, Relationship
  from models import Region, Graph, QA, QAObject, Synset
  import httplib
  import json
  import utils
  import os
  
  """
  Get Image ids from startIndex to endIndex.
  """
  def GetAllImageData(dataDir=None):
    if dataDir is None:
      dataDir = utils.GetDataDir()
    dataFile = os.path.join(dataDir, 'image_data.json')
    data = json.load(open(dataFile))
    return [utils.ParseImageData(image) for image in data]
  
  """
  Get all region descriptions.
  """
  def GetAllRegionDescriptions(dataDir=None):
    if dataDir is None:
      dataDir = utils.GetDataDir()
    dataFile = os.path.join(dataDir, 'region_descriptions.json')
    imageData = GetAllImageData()
    imageMap = {}
    for d in imageData:
      imageMap[d.id] = d
    images = json.load(open(dataFile))
    output = []
    for image in images:
      output.append(utils.ParseRegionDescriptions(image['regions'], imageMap[image['id']]))
    return output
  
  
  """
  Get all question answers.
  """
  def GetAllQAs(dataDir=None):
    if dataDir is None:
      dataDir = utils.GetDataDir()
    dataFile = os.path.join(dataDir, 'question_answers.json')
    imageData = GetAllImageData()
    imageMap = {}
    for d in imageData:
      imageMap[d.id] = d
    images = json.load(open(dataFile))
    output = []
    for image in images:
      output.append(utils.ParseQA(image['qas'], imageMap))
    return output
  
  
new_contents: from models import Image, Object, Attribute, Relationship
  from models import Region, Graph, QA, QAObject, Synset
  import httplib
  import json
  import utils
  import os
  
  """
  Get Image ids from startIndex to endIndex.
  """
  def GetAllImageData(dataDir=None):
    if dataDir is None:
      dataDir = utils.GetDataDir()
    dataFile = os.path.join(dataDir, 'image_data.json')
    data = json.load(open(dataFile))
    return [utils.ParseImageData(image) for image in data]
  
  """
  Get all region descriptions.
  """
  def GetAllRegionDescriptions(dataDir=None):
    if dataDir is None:
      dataDir = utils.GetDataDir()
    dataFile = os.path.join(dataDir, 'region_descriptions.json')
    imageData = GetAllImageData(dataDir)
    imageMap = {}
    for d in imageData:
      imageMap[d.id] = d
    images = json.load(open(dataFile))
    output = []
    for image in images:
      output.append(utils.ParseRegionDescriptions(image['regions'], imageMap[image['id']]))
    return output
  
  
  """
  Get all question answers.
  """
  def GetAllQAs(dataDir=None):
    if dataDir is None:
      dataDir = utils.GetDataDir()
    dataFile = os.path.join(dataDir, 'question_answers.json')
    imageData = GetAllImageData(dataDir)
    imageMap = {}
    for d in imageData:
      imageMap[d.id] = d
    images = json.load(open(dataFile))
    output = []
    for image in images:
      output.append(utils.ParseQA(image['qas'], imageMap))
    return output
  
  
subject: fix GetAllRegionDescriptions bug in the local API