添加制作label_studio上传文件脚本
This commit is contained in:
parent
ec049c3a17
commit
047a8c56f3
55
002合并文件夹.py
55
002合并文件夹.py
@ -16,20 +16,59 @@ def merge_folder(folder_path_list, output_folder_path):
|
||||
|
||||
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 = [
|
||||
'2c7cc83019e7388a7041101da92c9829',
|
||||
'3aee64cc1f90d93a5a45979f7b17cb4b',
|
||||
'7e82dc1494c43078ea771a7d0535befd',
|
||||
'9f0ee60ef8bed75d4e1b8911d45db353',
|
||||
'632e474452d560edd7004f745319ff00',
|
||||
'd52059567121035b1438551f96e99017',
|
||||
'fa473dc61cf47ea7d3b9934fb819546c',
|
||||
'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/读表图片")
|
||||
merge_folder(folder_path_list_new, "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/002目标检测图片")
|
||||
#-----------------------------------------合并目标检测图片end--------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
23
004制作label_studio_json上传文件.py
Normal file
23
004制作label_studio_json上传文件.py
Normal file
@ -0,0 +1,23 @@
|
||||
import os
|
||||
import json
|
||||
|
||||
def generate_label_studio_json(image_path, image_type=None, result=None):
|
||||
|
||||
pre_root = image_path.split('/')[-1]
|
||||
|
||||
json_list = list()
|
||||
|
||||
image_names = os.listdir(image_path)
|
||||
for i in range(len(image_names)):
|
||||
t_d = dict()
|
||||
t_d['data'] = {"image": f"/data/local-files/?d={pre_root}/{image_names[i]}"}
|
||||
json_list.append(t_d)
|
||||
|
||||
|
||||
with open(f"result.json", "w", encoding='utf-8') as f:
|
||||
json.dump(json_list, f, indent=4,ensure_ascii=False)
|
||||
|
||||
if __name__ == '__main__':
|
||||
image_path = "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/002目标检测图片"
|
||||
generate_label_studio_json(image_path)
|
||||
|
||||
10077
result.json
Normal file
10077
result.json
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -48,7 +48,8 @@ def test_ocr_api(image_path, api_url="http://10.0.0.202:12342/api/v1/ocr_from_ba
|
||||
|
||||
if __name__ == "__main__":
|
||||
# 测试图片路径,请根据实际情况修改
|
||||
test_image_path = "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/001读表图片/2c7cc83019e7388a7041101da92c9829_frame_000000.jpg"
|
||||
# test_image_path = "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/001读表图片/2c7cc83019e7388a7041101da92c9829_frame_000000.jpg"
|
||||
test_image_path = "/home/admin-root/haotian/康达瑞贝斯机器狗/data_image/001读表图片/632e474452d560edd7004f745319ff00_frame_000730.jpg"
|
||||
|
||||
# 调用测试函数
|
||||
test_ocr_api(test_image_path)
|
||||
Loading…
Reference in New Issue
Block a user