|
|
import uuid
|
|
|
from typing import Any, List
|
|
|
|
|
|
from sqlalchemy import JSON
|
|
|
from sqlmodel import SQLModel, Field
|
|
|
|
|
|
from crud.config.db import engine
|
|
|
|
|
|
|
|
|
def get_uuid():
|
|
|
return uuid.uuid1().hex
|
|
|
|
|
|
class Scene(SQLModel,table=True):
|
|
|
id: str = Field(default_factory=get_uuid, max_length=32, primary_key=True)
|
|
|
scene_name: str = Field(max_length=256, description="事件名称", unique=True)
|
|
|
calib_json: List[dict] = Field(sa_type=JSON, nullable=True, description="calib是从点云到图像的校准矩阵。它是可选的,但如果提供,该框将投影在图像上以帮助注释。")
|
|
|
desc: List[dict] = Field(sa_type=JSON, nullable=True, description="calib是从点云到图像的校准矩阵。它是可选的,但如果提供,该框将投影在图像上以帮助注释。")
|
|
|
|
|
|
class SceneWorldItem(SQLModel,table=True):
|
|
|
__tablename__ = "scene_world_item"
|
|
|
id: str = Field(default_factory=get_uuid, max_length=32, primary_key=True)
|
|
|
scene_id: str = Field(max_length=256, description="事件id")
|
|
|
scene_name: str = Field(max_length=256, description="事件名")
|
|
|
frame: str = Field(max_length=256, description="帧序号")
|
|
|
calib_json: List[dict] = Field(sa_type=JSON, nullable=True, description="calib是从点云到图像的校准矩阵。它是可选的,但如果提供,该框将投影在图像上以帮助注释。")
|
|
|
label_json: List[dict] = Field(sa_type=JSON, nullable=True, description="标注信息 == annotation")
|
|
|
ego_pose_json: List[dict] = Field(sa_type=JSON, nullable=True, description="")
|
|
|
|
|
|
front_img_path: str = Field(max_length=512, description="minio对应文件的路径")
|
|
|
left_img_path: str = Field(max_length=512, description="minio对应文件的路径")
|
|
|
right_img_path: str = Field(max_length=512, description="minio对应文件的路径")
|
|
|
|
|
|
lidar_pcd_path: str = Field(max_length=512, description="minio对应的pcd文件的路径")
|
|
|
# 初始化数据库表(异步执行)
|
|
|
SQLModel.metadata.create_all(engine) |