|
@@ -0,0 +1,52 @@
|
|
|
+from label_studio_sdk import Client
|
|
|
+from label_studio_sdk.data_manager import Filters, Column, Operator, Type
|
|
|
+
|
|
|
+LABEL_STUDIO_URL = "http://192.168.10.18:8081" # 或者是你的Label Studio的URL
|
|
|
+API_KEY = "b614d8c956495f52ea3f3f598c0be3f11866d9a0" # 从Label Studio获得你的API密钥
|
|
|
+
|
|
|
+#LABEL_STUDIO_URL = "http://localhost:8080" # 或者是你的Label Studio的URL
|
|
|
+#API_KEY = "87ae9ca430852c3b9753bacf214b7f90bedf5bdd" # 从Label Studio获得你的API密钥
|
|
|
+
|
|
|
+# 初始化 Label Studio 客户端
|
|
|
+ls = Client(url=LABEL_STUDIO_URL, api_key=API_KEY)
|
|
|
+
|
|
|
+projects = ls.get_projects()
|
|
|
+for project in projects:
|
|
|
+ print(f"Project ID: {project.id}, Project Title: {project.title}")
|
|
|
+
|
|
|
+# Project ID: 22, Project Title: LA_Table_Figure_V1.3_20230208
|
|
|
+# Project ID: 16, Project Title: LA_KR_1.0.0
|
|
|
+# Project ID: 14, Project Title: LA_VAL_1.0.0
|
|
|
+# Project ID: 12, Project Title: Demo1
|
|
|
+# Project ID: 10, Project Title: LA_0.1.0
|
|
|
+# Project ID: 4, Project Title: Test Project #1
|
|
|
+
|
|
|
+PROJECT_ID = 22 # 项目 ID
|
|
|
+
|
|
|
+# 获取项目
|
|
|
+project = ls.get_project(PROJECT_ID)
|
|
|
+
|
|
|
+filters = Filters.create(Filters.AND, [
|
|
|
+ Filters.item(
|
|
|
+ Column.inner_id,
|
|
|
+ Operator.GREATER_OR_EQUAL,
|
|
|
+ Type.Number,
|
|
|
+ Filters.value(1)
|
|
|
+ ),
|
|
|
+ Filters.item(
|
|
|
+ Column.inner_id,
|
|
|
+ Operator.LESS_OR_EQUAL,
|
|
|
+ Type.Number,
|
|
|
+ Filters.value(3000)
|
|
|
+ )
|
|
|
+])
|
|
|
+
|
|
|
+export_result = project.export(filters=filters, export_type='YOLO')
|
|
|
+
|
|
|
+# 导出数据
|
|
|
+# export_result = project.export_tasks(export_type = "YOLO",
|
|
|
+# download_all_tasks = False,
|
|
|
+# download_resources = True,
|
|
|
+# export_location = 'C:/test/yolo_export.zip')
|
|
|
+
|
|
|
+print('导出完成')
|