17 lines
664 B
Python
17 lines
664 B
Python
from label_studio_sdk import Client
|
|
import os
|
|
import shutil
|
|
|
|
# 连接 Label Studio
|
|
ls = Client(url='http://10.0.0.202:9432', api_key='ccbfb1432d8720230c8a0b9af53091bd3ef6e61c')
|
|
project = ls.get_project(id=5)
|
|
|
|
# 导出任务并处理图片
|
|
export_result = project.export_tasks(export_type='YOLO', export_location='export/yolo_obb_5.zip')
|
|
# os.makedirs("export/images", exist_ok=True)
|
|
|
|
# for task in export_result:
|
|
# if task['annotations']: # 仅处理已标注任务
|
|
# src_path = task['data']['image'] # 原始图片路径
|
|
# dst_path = f"export/images/{task['id']}.jpg"
|
|
# shutil.copy2(src_path, dst_path) # 复制图片到导出目录 |