python 判断两个集合相等
2020-12-27 22:30
标签:相等 lis ges project class port img span label python 判断两个集合相等 标签:相等 lis ges project class port img span label 原文地址:https://www.cnblogs.com/liutianrui1/p/13029618.htmlimport os
import cv2
if __name__ == ‘__main__‘:
img_path=r‘/home/cui/tianrui_projects/darknet53/code_data/raw_data/images/‘
label_path=r‘/home/cui/tianrui_projects/darknet53/code_data/raw_data/labels/‘
#保证数据一致性
all_imgs=set(map(lambda p:p.split(‘.‘)[0],os.listdir(img_path)))
all_labels=set(map(lambda p:p.split(‘.‘)[0],os.listdir(label_path)))
print(all_imgs.issubset(all_labels) and all_labels.issubset(all_imgs))