标签:shu shutil mic 文件 jpg 图片 account style 索引
‘‘‘ @author: Shang Tongtong @license: (C) Copyright 2019-present, SeetaTech, Co.,Ltd. @contact: tongtong.shang@seetatech.com @file: split_items_account_to_index.py @time: 19-8-1 16:24 @desc: 根据索引把文件分开保存 ‘‘‘ import os import shutil SUFFIX = ‘.jpg‘ def split_and_copy(index, origdir, newdir): indexname = str(index) + SUFFIX file = os.path.join(origdir, indexname) shutil.copy(file, newdir) if __name__ == ‘__main__‘: index_dir = r‘/home/stt/data/icebox/005/20190802/ImageSets/Main/train.txt‘ save_dir = r‘/home/stt/data/icebox/005/20190802/train/JPEGImages/‘ orig_dir = r‘/home/stt/data/icebox/005/20190802/JPEGImages/‘ f = open(index_dir) for line in f.readlines(): linesp = line.split()[0] split_and_copy(linesp, orig_dir, save_dir)
文件索引格式如下:
标签:shu shutil mic 文件 jpg 图片 account style 索引
原文地址:https://www.cnblogs.com/stt-ac/p/11290712.html