#!/usr/bin/env pythonfrom__future__importprint_functionimportos.pathasospimportnumpyasnpimportPIL.Imagehere=osp.dirname(osp.abspath(__file__))defmain():label_png=osp.join(here,'apc2016_obj3_json/label.png')print('Loading:',label_png)print()lbl=np.asarray(PIL.Image.open(label_png))labels=np.unique(lbl)label_names_txt=osp.join(here,'apc2016_obj3_json/label_names.txt')label_names=[name.strip()fornameinopen(label_names_txt)]print('# of labels:',len(labels))print('# of label_names:',len(label_names))iflen(labels)!=len(label_names):print('Number of unique labels and label_names must be same.')quit(1)print()print('label: label_name')forlabel,label_nameinzip(labels,label_names):print('%d: %s'%(label,label_name))if__name__=='__main__':main()