Files
MPKFNet/bigdata_copyall.py
2021-09-15 11:33:58 +08:00

32 lines
1.2 KiB
Python
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'''
author : Hatcher W
Email: hcwang@semi.ac.cn
use: 将所有的图片存储到一个文件夹中,便于后续筛选
input:两个json文件 用于提供所有的原始图片路径
output:在ALL文件中存储所有的图片
'''
import json
import os
import shutil
def bigdata_copy(desname):
with open("./vedioroot.json", 'r+') as fvedio:
vediolists = json.load(fvedio)
fvedio.close()
flag_detectlast = True
num = 0
for vediolist in vediolists:
image_num = str(num).zfill(7)
source_path = vediolist.replace(".MP4", "").replace(".mp4", "").replace(".MOV", "").replace(".mov", "").replace("/Hatcher/DATA/", "/Hatcher/model/data_MPKFNet/bigdata/resultdata/")
despath = "../data_MPKFNet/bigdata/ALL/"+desname
if not os.path.exists(despath):
os.makedirs(despath)
######finish vedio to image
for image in os.listdir(source_path):
shutil.copy(os.path.join(source_path,image),os.path.join(despath,image_num)+".jpg")
print(os.path.join(source_path,image))
num +=1
image_num = str(num).zfill(7)
if __name__ == "__main__":
bigdata_copy("Hat_Raw_Data")