code: def save_imglist(self, fname=None, root=None, shuffle=False):
          
          def progress_bar(count, total, suffix=''):
              import sys
              bar_len = 24
              filled_len = int(round(bar_len * count / float(total)))
  
              percents = round(100.0 * count / float(total), 1)
              bar = '=' * filled_len + '-' * (bar_len - filled_len)
              sys.stdout.write('[%s] %s%s ...%s\r' % (bar, percents, '%', suffix))
              sys.stdout.flush()
  
          str_list = []
          for index in range(self.num_images):
              progress_bar(index, self.num_images)
              label = self.label_from_index(index)
              if label.size < 1:
                  continue
              path = self.image_path_from_index(index)
              if root:
                  path = osp.relpath(path, root)
              str_list.append('\t'.join([str(index), str(2), str(label.shape[1])] \
                + ["{0:.4f}".format(x) for x in label.ravel()] + [path,]) + '\n')
          if str_list:
              if shuffle:
                  import random
                  random.shuffle(str_list)
              if not fname:
                  fname = self.name + '.lst'
              with open(fname, 'w') as f:
                  for line in str_list:
                      f.write(line)
          else:
              raise RuntimeError("No image in imdb")
docs: save imglist to disk
  
          Parameters:
          ----------
          fname : str
              saved filename