panlei
2019-12-16 1570637a67ec0849dbe53cff570c8691a9cff49b
arg新加一个参数
3个文件已修改
54 ■■■■ 已修改文件
algorithm/middleware/readyData.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
algorithm/personTrack/personTrack.go 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
structure/rule.go 46 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
algorithm/middleware/readyData.go
@@ -35,7 +35,7 @@
            // 这步要备齐表达式里所需要的所有参数
            a.TargetNum++
            uuid := uuid.NewV4().String()
            arg1 := structure.Arg{structure.SourceArg{obj.Id,uuid,obj.Score, ruleserver.PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.Type, obj.Rects, obj.Car,obj.Feature,obj.ThftRes, []*structure.BaseInfo{},"",structure.ResultMsg{}},structure.SourceArg{}}
            arg1 := structure.Arg{structure.SourceArg{obj.Id,uuid,obj.Score, ruleserver.PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.Type, obj.Rects, obj.Car,obj.Feature,obj.BodyFeature,obj.ThftRes, []*structure.BaseInfo{},"",structure.ResultMsg{}},structure.SourceArg{}}
            //logger.Println("放进去的arg:-------", arg1)
            a.Args = append(a.Args, &arg1)
            a.FilterData = append(a.FilterData, &arg1)
@@ -220,7 +220,7 @@
        }
        for _, info := range Track.Result {
            logger.Info("接收跟踪数据:",info.Id,info.Confidence,info.Feature)
            photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Id)),Score: float64(info.Confidence)*100,Rects: rectFormat(info.RcHuman), Type: "track"},structure.SourcePhoto{}}
            photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Id)),Score: float64(info.Confidence)*100,Rects: rectFormat(info.RcHuman), Type: "track",BodyFeature: info.Feature},structure.SourcePhoto{}}
            arg.Photo = append(arg.Photo, photoMap)
        }
        args.Sdkdata = append(args.Sdkdata, &arg)
algorithm/personTrack/personTrack.go
@@ -101,7 +101,7 @@
    trackArg["esId"] = esId
    trackArg["threshold"] = compareThreshold
    trackArg["cameraId"] = am.CameraId
    trackArg["bodyFeature"] = arg.Feature
    trackArg["bodyFeature"] = arg.BodyFeature
    trackArg["faceFeature"]    = arg.AttachArg.Feature
    logger.Info("请求张增飞比对数据参数:",trackArg)
    b,err := json.Marshal(trackArg)
@@ -120,7 +120,7 @@
}
func track (rule *protomsg.Rule,am *structure.AreaMap) structure.LittleRuleResult{
    var threshold float32 = 70 // 默认阈值为70
    var threshold float32 = 60 // 默认阈值为70
    if th,err := strconv.ParseFloat(rule.SdkArgValue,32); err == nil {
        threshold = float32(th)
    }
structure/rule.go
@@ -6,26 +6,28 @@
// 每个目标的参数:相似度,占比,尺寸
type SourceArg struct {
    Id            string
    Uuid          string
    Score         float64                  // 区域内的目标的相似度
    Proportion    float64                  // 区域内的目标的占比
    Size          float64                  // 区域内的目标的尺寸
    AreaJson      string                   // 所属区域
    Type          string                   // 记载数据类型
    Location      Rect                     // 记下每个目标的位置参数,最后给结果装配目标数据的时候用的到
    Car           *protomsg.PlateIDVehicle // 车辆参数
    Feature       []byte
    ThftRes       protomsg.ThftResult
    Liker         []*BaseInfo
    TimeLable     string
    CacheData     ResultMsg
    Id          string
    Uuid        string
    Score       float64                  // 区域内的目标的相似度
    Proportion  float64                  // 区域内的目标的占比
    Size        float64                  // 区域内的目标的尺寸
    AreaJson    string                   // 所属区域
    Type        string                   // 记载数据类型
    Location    Rect                     // 记下每个目标的位置参数,最后给结果装配目标数据的时候用的到
    Car         *protomsg.PlateIDVehicle // 车辆参数
    Feature     []byte
    BodyFeature []float32
    ThftRes     protomsg.ThftResult
    Liker       []*BaseInfo
    TimeLable   string
    CacheData   ResultMsg
}
type Arg struct {
    SourceArg
    AttachArg SourceArg
}
// 每个区域内的图片数据集合
type AreaMap struct {
    CameraId      string
@@ -46,14 +48,16 @@
}
type SourcePhoto struct {
    Id      string
    Rects   Rect    // 矩形区域参数
    Score   float64 // 相似度得分(有多大程度像一个目标。人脸,人体或车等等)
    Type    string  // 记载数据类型
    ThftRes protomsg.ThftResult
    Feature []byte
    Car     *protomsg.PlateIDVehicle
    Id          string
    Rects       Rect    // 矩形区域参数
    Score       float64 // 相似度得分(有多大程度像一个目标。人脸,人体或车等等)
    Type        string  // 记载数据类型
    ThftRes     protomsg.ThftResult
    Feature     []byte
    BodyFeature []float32
    Car         *protomsg.PlateIDVehicle
}
// sdk输出的图片上单个目标的数据
type PhotoMap struct {
    SourcePhoto