75 lines
2.9 KiB
Python
75 lines
2.9 KiB
Python
import os
|
|
import shutil
|
|
|
|
|
|
def merge_folder(folder_path_list, output_folder_path):
|
|
|
|
os.makedirs(output_folder_path, exist_ok=True)
|
|
|
|
for folder_path in folder_path_list:
|
|
folder_name = folder_path.split("/")[-1]
|
|
for file_name in os.listdir(folder_path):
|
|
file_path = os.path.join(folder_path, file_name)
|
|
file_name_new = folder_name + "_" + file_name
|
|
if os.path.isfile(file_path):
|
|
shutil.move(file_path, os.path.join(output_folder_path, file_name_new))
|
|
|
|
if __name__ == "__main__":
|
|
|
|
|
|
# #------------------------------------------合并读表图片-------------------------------------------------------
|
|
# folder_path_list = [
|
|
# '2c7cc83019e7388a7041101da92c9829',
|
|
# '3aee64cc1f90d93a5a45979f7b17cb4b',
|
|
# '7e82dc1494c43078ea771a7d0535befd',
|
|
# '9f0ee60ef8bed75d4e1b8911d45db353',
|
|
# '632e474452d560edd7004f745319ff00',
|
|
# 'd52059567121035b1438551f96e99017',
|
|
# 'fa473dc61cf47ea7d3b9934fb819546c',
|
|
# ]
|
|
|
|
# base_path = '/home/admin-root/haotian/康达瑞贝斯机器狗/data_image'
|
|
|
|
# folder_path_list_new = [os.path.join(base_path, folder_path) for folder_path in folder_path_list]
|
|
|
|
# merge_folder(folder_path_list_new, "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/读表图片")
|
|
# #-----------------------------------------合并读表图片end------------------------------------------------------
|
|
|
|
|
|
|
|
#------------------------------------------合并目标检测图片start--------------------------------------------------
|
|
folder_path_list = [
|
|
'1e4c75b76e531606e2adc491a8f09ae8',
|
|
'2df155d13da8521359a585ec9cb428d1',
|
|
'6cbe732a27682976832190a5810239d3',
|
|
'50a9b4596408c4eef28941a37e5f9ac5',
|
|
'68bebc53c35d093f1ea2e0686154f27c',
|
|
'75ab7fa3ff2395923ef030d9ba08f021',
|
|
'866eb16ab8ffb3af8cb7db4daaa4931e',
|
|
'5783e998cb074f8f3a04944fc32c69b4',
|
|
'8725371e25880b240734063a470ae0bf',
|
|
'47789285e91c2a33fe1c06838cccca50',
|
|
'a865388de7bb555f3e9fd0e548951a9f',
|
|
'c1772b5017462044bbc292c991a68919',
|
|
'c090126c3bd73104fd3f40a9a2dbcb64',
|
|
'ccff11a887a8e98f9bce99dcf0e325a9',
|
|
'ce81420a27cdaff14fe42f967eaa49a3',
|
|
'd5a01bd2cf4e5808acef49d1da48b289',
|
|
'e7d805fd267bd6f54e4020e4e20b1bf1',
|
|
'ea1d0d0626f926e9c4f9f86d0cc27ef4'
|
|
|
|
|
|
|
|
|
|
|
|
]
|
|
|
|
base_path = '/home/admin-root/haotian/康达瑞贝斯机器狗/data_image'
|
|
|
|
folder_path_list_new = [os.path.join(base_path, folder_path) for folder_path in folder_path_list]
|
|
|
|
merge_folder(folder_path_list_new, "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/002目标检测图片")
|
|
#-----------------------------------------合并目标检测图片end--------------------------------------------------------
|
|
|
|
|