| | |
| | | |
| | | require ( |
| | | basic.com/dbapi.git v0.0.0-20191025084729-a04db890e7b5 |
| | | basic.com/fileserver/WeedFSClient.git v0.0.0-20191105073656-98059e699477 |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191025080939-9b30ac3be52d |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191105082616-7a5fc5da9c09 |
| | | basic.com/valib/deliver.git v0.0.0-20190927081905-2d390df9ede3 |
| | | basic.com/valib/gopherdiscovery.git v0.0.0-20190605034340-15d89d8b4e28 |
| | | basic.com/valib/logger.git v0.0.0-20190928113028-4907b08c4159 |
| | |
| | | github.com/go-yaml/yaml v2.1.0+incompatible |
| | | github.com/gogo/protobuf v1.2.1 |
| | | github.com/golang/protobuf v1.3.1 |
| | | github.com/kirinlabs/HttpRequest v0.1.5 // indirect |
| | | github.com/knetic/govaluate v3.0.0+incompatible |
| | | github.com/pierrec/lz4 v2.2.3+incompatible |
| | | github.com/satori/go.uuid v1.2.0 |
| | |
| | | basic.com/dbapi.git v0.0.0-20190822081128-ce924b8a905f/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q= |
| | | basic.com/dbapi.git v0.0.0-20191025084729-a04db890e7b5 h1:OcZOgjBXfzhI1Ukxblacxu5xwKl448ADYyulJ02zdb8= |
| | | basic.com/dbapi.git v0.0.0-20191025084729-a04db890e7b5/go.mod h1:eDXPnxaz6jZPDvBSk7ya7oSASWPCuUEgRTJCjsfKt/Q= |
| | | basic.com/fileserver/WeedFSClient.git v0.0.0-20191105073656-98059e699477 h1:yr95Oko76zjDlPs60aHT2lAqApz8nzli9A6yJB/IrGA= |
| | | basic.com/fileserver/WeedFSClient.git v0.0.0-20191105073656-98059e699477/go.mod h1:oiXPn3wwwOi/Sbm6cDWpNWofoG5iV2Nb1V/DxLEAqYY= |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48 h1:BBA30Rgljn6MRieC4gUncETJDyna3ObyubTo9HEQ2M0= |
| | | basic.com/pubsub/cache.git v0.0.0-20190718093725-6a413e1d7d48/go.mod h1:gHLJZz2ee1cGL0X0ae69fs56bAxkDgEQwDhhXZJNUcY= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20190905061607-7b96dafe8f99 h1:YSmWZPp/mHoq+/L5d0iTsqjiCcVwZqEQRQAXxQFSbvY= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20190905061607-7b96dafe8f99/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191025080939-9b30ac3be52d h1:Lhny6vIq3GNjunE+r0ymLnpg+/n0lqwnsOAy6HbARfk= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191025080939-9b30ac3be52d/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191105075705-11a3749018a7 h1:6B15QTE96XgpT2Ry9a3xhJZzxYvP6rClT3l4r2WHrjE= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191105075705-11a3749018a7/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191105082616-7a5fc5da9c09 h1:wktnrfZLxcSEnmu/ptMdn4GF5UiHcUdRSlWQ0EllJxY= |
| | | basic.com/pubsub/protomsg.git v0.0.0-20191105082616-7a5fc5da9c09/go.mod h1:un5NV5VWQoblVLZfx1Rt5vyLgwR0jI92d3VJhfrJhWU= |
| | | basic.com/pubsub/sdkcompare.git v0.0.0-20190715013640-f536a4647d00 h1:sK+Tx7rvM9J2WnNIwrzMDjZSylWiKNfQO0prUBfKsDk= |
| | | basic.com/pubsub/sdkcompare.git v0.0.0-20190715013640-f536a4647d00/go.mod h1:8by33F9E1w17Pw/rDgJGJXAo122w0wDENG14hiMS+RE= |
| | | basic.com/valib/deliver.git v0.0.0-20190531095353-25d8c3b20051 h1:9flC2o3kasaM2Y6I+mY+mxmve/pyAY/UzGQZLT3lFHM= |
| | |
| | | github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= |
| | | github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= |
| | | github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= |
| | | github.com/kirinlabs/HttpRequest v0.1.5 h1:BzOb6AmBii232R93birBsf663kt8N9y8N0TCQKoEzhA= |
| | | github.com/kirinlabs/HttpRequest v0.1.5/go.mod h1:XV38fA4rXZox83tlEV9KIQ7Cdsut319x6NGzVLuRlB8= |
| | | github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= |
| | | github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= |
| | | github.com/knetic/govaluate v3.0.0+incompatible h1:wtCEE87YYq68awKAV9kYkNDvxS7MDzO3ABbKgDqO+tI= |
| | |
| | | imgMaxUrl = bigPhotoUrl["fileUrl"].(string) |
| | | picTime = i.Timestamp |
| | | } |
| | | // 人脸检测,没有相似的底库人员 |
| | | localConfig, err := cache.GetServerInfo() |
| | | if err != nil { |
| | | logger.Error("查询本机信息失败!") |
| | | } |
| | | serverIp, err := GetLocalIP() |
| | | // 查询cameraName |
| | | camera, err := cache.GetCameraById(msg.Cid) |
| | | if err != nil { |
| | | logger.Error("查询摄像机信息失败") |
| | | } |
| | | |
| | | //logger.Info("================小图地址:", resp["fileUrl"].(string)) |
| | | sex := "" |
| | | logger.Info(sex) |
| | | if face.ThftRes.Gender == 1 { |
| | |
| | | pervideo := PerVideoPicture{ |
| | | esDataId, |
| | | msg.Cid, |
| | | camera.Addr, |
| | | msg.Push.Cam.Addr, |
| | | picTime, |
| | | imgMaxUrl, |
| | | msg.Tasklab.Taskid, |
| | |
| | | base64.StdEncoding.EncodeToString(face.Feature), |
| | | []string{resp["fileUrl"].(string)}, |
| | | "暂无集群", |
| | | localConfig.ServerId, |
| | | localConfig.ServerName, |
| | | serverIp, |
| | | msg.Push.ServerId, |
| | | msg.Push.ServerName, |
| | | msg.Push.LocalIp, |
| | | "", |
| | | linksId, |
| | | face.Score, |
| | |
| | | } else { |
| | | logger.Info("插入es返回的信息:", resp1) |
| | | // 发出录像信号 |
| | | ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, ImgId: i.Id, SdkIds: []string{}, Type: 1}) |
| | | ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl:msg.Push.VideoUrl,ImgId: i.Id, SdkIds: []string{}, Type: 1}) |
| | | } |
| | | } |
| | | } |
| | |
| | | // 不是报警数据不存 |
| | | return |
| | | } |
| | | // logger.Println("图片上传返回值:", resp) |
| | | // 查询本机信息 |
| | | localConfig, err := cache.GetServerInfo() |
| | | if err != nil { |
| | | logger.Error("查询本机信息失败!") |
| | | } |
| | | // 查询cameraName |
| | | camera, err := cache.GetCameraById(msg.Cid) |
| | | if err != nil { |
| | | logger.Error("查询摄像机信息失败") |
| | | } |
| | | logger.Info("摄像机信息:",camera) |
| | | serverIp, err := GetLocalIP() |
| | | logger.Info("%%%%%%%%%%%%%%%%%yolo的target信息:",targetInfos) |
| | | |
| | | if resp["fileUrl"] != nil { |
| | | url = append(url, resp["fileUrl"].(string)) |
| | | esDataId := uuid.NewV4().String() |
| | |
| | | peraction := Personaction{ |
| | | esDataId, |
| | | msg.Cid, |
| | | camera.Name, |
| | | camera.Addr, |
| | | msg.Push.Cam.Name, |
| | | msg.Push.Cam.Addr, |
| | | msg.Tasklab.Taskid, |
| | | msg.Tasklab.Taskname, |
| | | sdkNames, |
| | | "", |
| | | alarmRules, |
| | | localConfig.ServerId, |
| | | localConfig.ServerName, |
| | | serverIp, |
| | | msg.Push.ServerId, |
| | | msg.Push.ServerName, |
| | | msg.Push.LocalIp, |
| | | "", |
| | | url, |
| | | i.Timestamp, |
| | |
| | | } else { |
| | | logger.Debug("插入es返回的数据信息是:", resp1) |
| | | // 发出录像信号 |
| | | ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, ImgId: i.Id, SdkIds: []string{}, Type: 2}) |
| | | ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: esDataId, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid,VideoUrl:msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{}, Type: 2}) |
| | | logger.Warn("__________________________________________往ES插入yolo数据成功") |
| | | //os.Exit(1) |
| | | } |
| | |
| | | "time" |
| | | |
| | | "basic.com/valib/logger.git" |
| | | //"bufio" |
| | | //"bytes" |
| | | "flag" |
| | | "fmt" |
| | | "github.com/golang/protobuf/proto" |
| | | "github.com/spf13/viper" |
| | | //"gocv.io/x/gocv" |
| | | //"image" |
| | | //"image/color" |
| | | //"os" |
| | | "ruleprocess/cache" |
| | | "ruleprocess/ruleserver" |
| | | "sync" |
| | |
| | | ruleserver.Judge(&arg, &m) // 把sdkMessage传进去,方便缓存数据时拼出一个resultMag |
| | | // 把arg里的打的标签拿出来给m再封装一层 |
| | | resultMsg := structure.ResultMsg{SdkMessage: &m, RuleResult: arg.RuleResult} |
| | | ruleserver.GetAttachInfo(resultMsg.SdkMessage) |
| | | ruleEnd := time.Since(start) |
| | | logger.Debug("规则判断完所用时间:", ruleEnd) |
| | | // 将打完标签的数据插入到ES |
| | |
| | | logger.Debug("插入完Es所用时间:", esEnd) |
| | | //事件推送 |
| | | //labelFilter.PushSomthing(resultMsg) |
| | | //pushEnd := time.Since(start) |
| | | //logger.Info("事件推送完所用时间:",ruleEnd,esEnd,pushEnd) |
| | | }(msg) |
| | | } |
| | | } |
New file |
| | |
| | | package ruleserver |
| | | |
| | | import ( |
| | | "basic.com/pubsub/protomsg.git" |
| | | "basic.com/valib/logger.git" |
| | | "ruleprocess/cache" |
| | | "basic.com/fileserver/WeedFSClient.git" |
| | | "strconv" |
| | | ) |
| | | func GetAttachInfo(msg *protomsg.SdkMessage){ |
| | | //人脸检测,没有相似的底库人员 |
| | | localConfig, err := cache.GetServerInfo() |
| | | if err != nil { |
| | | logger.Error("查询本机信息失败!") |
| | | } |
| | | msg.Push.ServerId = localConfig.ServerId |
| | | msg.Push.ServerName = localConfig.ServerName |
| | | serverIp, err := GetLocalIP() |
| | | msg.Push.LocalIp = serverIp |
| | | // 查询cameraName |
| | | camera, err := cache.GetCameraById(msg.Cid) |
| | | if err != nil { |
| | | logger.Error("查询摄像机信息失败") |
| | | } |
| | | msg.Push.Cam = &camera |
| | | // 视频地址占位符 |
| | | localConfig1, err := cache.GetServerInfo() |
| | | if err != nil { |
| | | panic("配置文件不合法") |
| | | } |
| | | weedfsUrl := "http://" + localConfig1.WebPicIp + ":" + strconv.Itoa(int(localConfig1.WebPicPort)) + "/dir/assign" |
| | | if path,err := WeedFSClient.GetFid(weedfsUrl);err !=nil { |
| | | msg.Push.VideoUrl = path |
| | | } |
| | | } |