深度学习对比Annotations和JPEGImages目录内文件

import os

xmlfilepath = 'Annotations'
total_xml = os.listdir(xmlfilepath)
imgfilepath = 'JPEGImages'
total_image = os.listdir(imgfilepath)

for xmlfile in total_xml:
    fileName = xmlfile.split('.')[0]+'.jpg'
    if total_image.count(fileName) == 0:
        print(fileName)
        #os.remove(xmlfilepath+'/'+xmlfile)

for imgfile in total_image:
    newfileName = imgfile.split('.')[0]+'.xml'
    if total_xml.count(newfileName) == 0:
        print(newfileName)
        #os.remove(imgfilepath+'/'+imgfile)

 

你可能感兴趣的:(深度学习,tensorflow)