RODY/app/schemas/TrainResult.py
552068321@qq.com 6f7de660aa first commit
2022-11-04 17:37:08 +08:00

65 lines
2.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

"""
@Time 2022/9/29 11:39
@Auth
@File TrainResult.py
@IDE PyCharm
@MottoABC(Always Be Coding)
@Desc训练报告结果类
"""
import datetime
from typing import List, Dict
from pydantic import BaseModel, Field
class ProcessValueList(BaseModel):
name: str = Field(..., description='名称')
value: List[int] = Field(..., description='过程值,如损失值,精度等')
class Report(BaseModel):
"""
训练算法返回值规范
"""
id: str = Field(..., description='唯一值')
rate_of_progess: float = Field(..., description='进度,保留一位小数')
precision: List[ProcessValueList] = Field(..., description="过程值列表")
sum: int = Field(..., description='总轮次')
progress: int = Field(..., description='当前轮次')
isfinish: int = Field(0, description="是否结束")
num_train_img: int = Field(..., description="参与训练图像数量")
train_mod_savepath: str = Field(..., description="模型保存路径")
start_time: datetime.date = Field(datetime.datetime.now(), description="开始时间")
end_time: datetime.date = Field(datetime.datetime.now(), description="结束时间")
class ReportDict(BaseModel):
"""
验证算法返回值规范
"""
id: str = Field(..., description='唯一值')
rate_of_progess: float = Field(..., description='进度,保留一位小数')
precision: List[Dict] = Field(..., description="过程值列表")
start_time: datetime.date = Field(datetime.datetime.now(), description="开始时间")
end_time: datetime.date = Field(datetime.datetime.now(), description="结束时间")
class DetectProcessValueDice(BaseModel):
"""
检测算法中间值
"""
ori_img: str = Field(..., description='原时图片路径, 绝对路径')
res_img: str = Field(..., description='结果图片路径, 绝对路径')
class DetectReport(BaseModel):
"""
检测算法返回值规范
"""
id: str = Field(..., description='唯一值')
rate_of_progess: float = Field(..., description='进度,保留一位小数')
precision: List[DetectProcessValueDice] = Field(..., description="过程值列表")
start_time: datetime.date = Field(datetime.datetime.now(), description="开始时间")
end_time: datetime.date = Field(datetime.datetime.now(), description="结束时间")