code: def get_keep_pos_idxs(labels, remove_blank=None):
      """
      Remove duplicate and get pos idxs of keep items.
      The value of keep_blank should be [None, 95].
      """
      duplicate_len_list = []
      keep_pos_idx_list = []
      keep_char_idx_list = []
      for k, v_ in groupby(labels):
          current_len = len(list(v_))
          if k != remove_blank:
              current_idx = int(
                  sum(duplicate_len_list) + current_len // 2
              )
              keep_pos_idx_list.append(current_idx)
              keep_char_idx_list.append(k)
          duplicate_len_list.append(current_len)
      return keep_char_idx_list, keep_pos_idx_list
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import cv2
  import math
  import numpy
  from itertools import groupby
  from skimage.morphology._skeletonize import thin
label_desc: Use image node_id 6 for calling a global function with example usage: get_keep_pos_idxs(labels, remove_blank) and returns: keep_char_idx_list,  keep_pos_idx_list