97 lines
4.0 KiB
Go
97 lines
4.0 KiB
Go
package dto
|
||
|
||
import (
|
||
"github.com/gogf/gf/v2/frame/g"
|
||
"github.com/gogf/gf/v2/net/ghttp"
|
||
"github.com/gogf/gf/v2/os/gtime"
|
||
)
|
||
|
||
// 假目标上报(技术设计.md「假目标上报」):App 识别端误报一键回流负样本库。
|
||
// 合规:客户端 jpg 重编码剥离全部元数据,首用单独同意由 App 承担。
|
||
|
||
// ---------- App ----------
|
||
|
||
// FalseTargetReportReq 上报假目标(multipart):file = 上报瞬间的分析帧整图
|
||
// (与喂给 YOLO 的帧同源同尺寸,jpg q85 重编码),detections = 当前全部检测框
|
||
// 快照 JSON([{label,class,score,model,cx,cy,w,h}],归一化坐标,供审核参考)。
|
||
type FalseTargetReportReq struct {
|
||
g.Meta `path:"/feedback/false-target" method:"post" summary:"上报假目标" tags:"客户端" mime:"multipart/form-data"`
|
||
File *ghttp.UploadFile `json:"file" v:"required" dc:"分析帧整图(jpg,与推理帧同尺寸)"`
|
||
Detections string `json:"detections" dc:"检测框快照JSON数组,空=上报时无框"`
|
||
SourceW int `json:"sourceW" v:"min:0" dc:"分析帧宽"`
|
||
SourceH int `json:"sourceH" v:"min:0" dc:"分析帧高"`
|
||
}
|
||
|
||
type FalseTargetReportRes struct {
|
||
Id int64 `json:"id"`
|
||
}
|
||
|
||
// ---------- 管理端 ----------
|
||
|
||
// AdminFalseTargetListReq 上报分页列表
|
||
type AdminFalseTargetListReq struct {
|
||
g.Meta `path:"/false-targets" method:"get" summary:"假目标上报列表" tags:"管理端"`
|
||
PhoneNum string `json:"phoneNum" v:"length:0,20" dc:"手机号精确过滤"`
|
||
Status string `json:"status" v:"in:,pending,approved" dc:"状态过滤,空=全部"`
|
||
Page int `json:"page" v:"integer|min:1" dc:"页码,默认 1"`
|
||
Size int `json:"size" v:"integer|min:1|max:100" dc:"每页条数,默认 20"`
|
||
}
|
||
|
||
// FalseTargetBox 检测框快照(归一化坐标相对原分析帧)
|
||
type FalseTargetBox struct {
|
||
Label string `json:"label"`
|
||
Class int `json:"class"`
|
||
Score float64 `json:"score"`
|
||
Model string `json:"model"`
|
||
Cx float64 `json:"cx"`
|
||
Cy float64 `json:"cy"`
|
||
W float64 `json:"w"`
|
||
H float64 `json:"h"`
|
||
}
|
||
|
||
// FalseTargetSnapshot labels_json 序列化结构:框快照 + 原分析帧尺寸
|
||
type FalseTargetSnapshot struct {
|
||
SourceW int `json:"sourceW"`
|
||
SourceH int `json:"sourceH"`
|
||
Boxes []*FalseTargetBox `json:"boxes"`
|
||
}
|
||
|
||
// AdminFalseTargetItem 上报条目(附裁剪图预览地址与检测框快照)
|
||
type AdminFalseTargetItem struct {
|
||
Id int64 `json:"id"`
|
||
PhoneNum string `json:"phoneNum"`
|
||
Species string `json:"species"`
|
||
Status string `json:"status"`
|
||
ImageUrl string `json:"imageUrl"`
|
||
Boxes []*FalseTargetBox `json:"boxes"`
|
||
SourceW int `json:"sourceW"`
|
||
SourceH int `json:"sourceH"`
|
||
SuspectReal int `json:"suspectReal"` // RF-DETR 高分检出疑似真目标预判(0/1,审核辅助标记)
|
||
CreatedAt *gtime.Time `json:"createdAt"`
|
||
ReviewedAt *gtime.Time `json:"reviewedAt"`
|
||
}
|
||
|
||
type AdminFalseTargetListRes struct {
|
||
Total int64 `json:"total"`
|
||
List []*AdminFalseTargetItem `json:"list"`
|
||
}
|
||
|
||
// AdminFalseTargetImageReq 裁剪图预览(静态字节流)
|
||
type AdminFalseTargetImageReq struct {
|
||
g.Meta `path:"/false-targets/image" method:"get" summary:"假目标裁剪图" tags:"管理端"`
|
||
Id int64 `json:"id" v:"required|min:1" dc:"上报 id"`
|
||
}
|
||
|
||
type AdminFalseTargetImageRes struct{}
|
||
|
||
// AdminFalseTargetReviewReq 审核:通过 = 迁移入负样本库当背景图;拒绝 = 删文件
|
||
type AdminFalseTargetReviewReq struct {
|
||
g.Meta `path:"/false-targets/review" method:"post" summary:"审核假目标上报" tags:"管理端"`
|
||
Ids []int64 `json:"ids" v:"required|min-length:1" dc:"上报 id 列表"`
|
||
Approve bool `json:"approve" dc:"true=通过 false=拒绝"`
|
||
}
|
||
|
||
type AdminFalseTargetReviewRes struct {
|
||
Affected int64 `json:"affected"` // 实际审核条数(过滤掉不存在/非 pending)
|
||
}
|