def read_label_file(dataset_dir, filename=LABELS_FILENAME):
 labels_filename = os.path.join(dataset_dir, filename)
 with tf.gfile.Open(labels_filename, 'r') as f:
  lines = f.read().decode()
 lines = lines.split('\n')
 lines = filter(None, lines)
 labels_to_class_names = {}
 for line in lines:
  index = line.index(':')
  labels_to_class_names[int(line[:index])] = line[(index + 1):]
 return labels_to_class_names

def read_label_file ( dataset_dir , filename = LABELS_FILENAME ) : labels_filename = os . path . join ( dataset_dir , filename ) with tf . gfile . Open ( labels_filename , 'r' ) as f : lines = f . read ( ) . decode ( ) lines = lines . split ( '\n' ) lines = filter ( None , lines ) labels_to_class_names = { } for line in lines : index = line . index ( ':' ) labels_to_class_names [ int ( line [ : index ] ) ] = line [ ( index + 1 ) : ] return labels_to_class_names
reads the labels file and returns a mapping from id to class name .