You've already forked DataMate
LSF
This commit is contained in:
@@ -13,7 +13,8 @@ from .user_management import (
|
||||
|
||||
from .annotation_management import (
|
||||
AnnotationTemplate,
|
||||
LabelingProject
|
||||
LabelingProject,
|
||||
AnnotationResult
|
||||
)
|
||||
|
||||
from .data_evaluation import (
|
||||
@@ -30,6 +31,7 @@ __all__ = [
|
||||
"User",
|
||||
"AnnotationTemplate",
|
||||
"LabelingProject",
|
||||
"AnnotationResult",
|
||||
"EvaluationTask",
|
||||
"EvaluationItem",
|
||||
]
|
||||
|
||||
@@ -33,10 +33,10 @@ class AnnotationTemplate(Base):
|
||||
"""检查是否已被软删除"""
|
||||
return self.deleted_at is not None
|
||||
|
||||
class LabelingProject(Base):
|
||||
"""标注项目模型"""
|
||||
|
||||
__tablename__ = "t_dm_labeling_projects"
|
||||
class LabelingProject(Base):
|
||||
"""标注项目模型"""
|
||||
|
||||
__tablename__ = "t_dm_labeling_projects"
|
||||
|
||||
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="UUID")
|
||||
dataset_id = Column(String(36), nullable=False, comment="数据集ID")
|
||||
@@ -53,13 +53,29 @@ class LabelingProject(Base):
|
||||
return f"<LabelingProject(id={self.id}, name={self.name}, dataset_id={self.dataset_id})>"
|
||||
|
||||
@property
|
||||
def is_deleted(self) -> bool:
|
||||
"""检查是否已被软删除"""
|
||||
return self.deleted_at is not None
|
||||
|
||||
|
||||
class AutoAnnotationTask(Base):
|
||||
"""自动标注任务模型,对应表 t_dm_auto_annotation_tasks"""
|
||||
def is_deleted(self) -> bool:
|
||||
"""检查是否已被软删除"""
|
||||
return self.deleted_at is not None
|
||||
|
||||
|
||||
class AnnotationResult(Base):
|
||||
"""标注结果模型(单人单份最终标签,Label Studio annotation 原始 JSON)"""
|
||||
|
||||
__tablename__ = "t_dm_annotation_results"
|
||||
|
||||
id = Column(String(36), primary_key=True, default=lambda: str(uuid.uuid4()), comment="UUID")
|
||||
project_id = Column(String(36), nullable=False, comment="标注项目ID(t_dm_labeling_projects.id)")
|
||||
file_id = Column(String(36), nullable=False, comment="文件ID(t_dm_dataset_files.id)")
|
||||
annotation = Column(JSON, nullable=False, comment="Label Studio annotation 原始JSON(单人单份最终结果)")
|
||||
created_at = Column(TIMESTAMP, server_default=func.current_timestamp(), comment="创建时间")
|
||||
updated_at = Column(TIMESTAMP, server_default=func.current_timestamp(), onupdate=func.current_timestamp(), comment="更新时间")
|
||||
|
||||
def __repr__(self):
|
||||
return f"<AnnotationResult(id={self.id}, project_id={self.project_id}, file_id={self.file_id})>"
|
||||
|
||||
|
||||
class AutoAnnotationTask(Base):
|
||||
"""自动标注任务模型,对应表 t_dm_auto_annotation_tasks"""
|
||||
|
||||
__tablename__ = "t_dm_auto_annotation_tasks"
|
||||
|
||||
@@ -92,4 +108,4 @@ class AutoAnnotationTask(Base):
|
||||
@property
|
||||
def is_deleted(self) -> bool:
|
||||
"""检查是否已被软删除"""
|
||||
return self.deleted_at is not None
|
||||
return self.deleted_at is not None
|
||||
|
||||
Reference in New Issue
Block a user