def _load_captions(captions_file):
  """Loads flickr8k captions.

  Args:
    captions_file: txt file containing caption annotations in 
    '<image file name>#<0-4> <caption>' format

  Returns:
    A dict of image filename to captions.
  """
  f_captions = open(captions_file, 'rb')
  captions = f_captions.read().decode().strip().split('\n')
  data = {}
  for row in captions:
    row = row.split("\t")
    row[0] = row[0][:len(row[0])-2]
    try:
      data[row[0]].append(row[1])
    except:
      data[row[0]] = [row[1]]
  f_captions.close()
  return data