一.上代码 import cv2 import os def get_samples(dir): datasets = [] files = os.listdir(dir) for file in files: ext_sp = os.path.splitext(file) if ext_sp[1] not in ['.jpg', '.bmp', '.png']: continue if not os.path.exists(os.path.join(dir, ext_sp[0] + '.txt…