图片和标注进行重新命名并保存到新的文件夹
imgpath = './img'
new_imgpath = './new_img'
jsonpath = './gt'
new_jsonpath = './new_json'
j = 0 #文件名起始
for root, dirs, files in os.walk(imgpath):
for i in range(len(files)):
json_file = files[i].split('.')[0]
shutil.copy(os.path.join(imgpath,files[i]), os.path.join(new_imgpath, str(j).zfill(12) + '.jpg'))
shutil.copy(os.path.join(jsonpath,json_file + '.json'), os.path.join(new_jsonpath, str(j).zfill(12) + '.json'))
j += 1
print ('this work has done')