65 lines
2.3 KiB
Python
65 lines
2.3 KiB
Python
"""
|
||
@Time : 2022/9/29 11:39
|
||
@Auth : 东
|
||
@File :TrainResult.py
|
||
@IDE :PyCharm
|
||
@Motto:ABC(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="结束时间")
|