#encoding=utf8 #所有jpg文件内含box的数目 #统计二级目录下jpg的数目 from basicFun import FILES import sys if __name__ == "__main__": rootDir = sys.argv[1] allJpgs = [x for x in FILES.list_all_files(rootDir) if '.jpg' in x] print(len(allJpgs))
from basicFun import FILES imgRoot='/DATACENTER4/hao.yang/project/Qin/data/imgs/isle/imgs_isle_17312_divide/' allImg=FILES.list_all_files(imgRoot) print(len(allImg))
# encoding=utf8 import os import shutil from basicFun import FILES if __name__ == "__main__": count = 0 referDir = r"/DATACENTER4/hao.yang/project/Qin/data/imgs/checkout/imgs_checkout_10583_divide/" referForm = ".jpg" sourDir = r"/DATACENTER3/fhn/xian_data/datasets/checkout/20190704_10972/xml_checkout_10972_total/" sourForm = ".xml" tarDir = r"/DATACENTER4/hao.yang/project/Qin/data/imgs/checkout/0705/" tarForm = sourForm allRefers = [x for x in FILES.list_all_files(referDir) if referForm in x] #审核为.refer形成列表 allJpgs = [x for x in FILES.list_all_filePaths(sourDir) if sourForm in x] FILES.mkdir(tarDir) for jpgPath in allJpgs: if jpgPath.split('/')[-1].replace(sourForm, referForm) not in allRefers: shutil.copy(jpgPath, os.path.join(tarDir, jpgPath.split('/')[-1])) count += 1 print("copy jpgs:", count)