| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 依据图片添加底库人员 |
| | | // @Description 依据图片添加底库返回数据人员 |
| | | // @Accept mpfd |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param file formData file true "底库人员图片" |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 人脸提取 |
| | | // @Description 人脸提取 |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags 以图搜图 |
| | | // @Param file formData file true "人员图片" |
| | |
| | | logger.Debug("comp videoPersons.len:",len(videopersons)) |
| | | for _,vp :=range videopersons { |
| | | isAlarmInt, _ := strconv.Atoi(vp.IsAlarm) |
| | | bi := make([]DbPersonVo,0) |
| | | var bi []DbPersonVo |
| | | for _,p :=range vp.BaseInfo { |
| | | bi = append(bi, DbPersonVo{ |
| | | PersonId: p.PersonId, |
| | |
| | | PhoneNum: p.PhoneNum, |
| | | Sex: p.Sex, |
| | | TableId: p.TableId, |
| | | BwType: strconv.Itoa(int(p.BwType)), |
| | | BwType: p.BwType, |
| | | TableName: p.TableName, |
| | | }) |
| | | } |
| | |
| | | logger.Debug("searchPhoto first Result.len:",len(*co.CompareData),"twice len(captureIds):",len(captureIds)) |
| | | if captureIds !=nil { |
| | | var aResult protomsg.SdkCompareResult |
| | | aList := getTwiceSearchResult(co, &captureIds) |
| | | aList := getTwiceSearchResult(co, &captureIds, searchBody) |
| | | aTotal := aList.Len() |
| | | if aTotal <= to { |
| | | aResult.CompareResult = (*aList)[from:aTotal] |
| | |
| | | personIdArr = append(personIdArr, pid.Id) |
| | | } |
| | | var aResult protomsg.SdkCompareResult |
| | | aList := getTwiceSearchResult(co, &personIdArr) |
| | | aList := getTwiceSearchResult(co, &personIdArr, searchBody) |
| | | aTotal := aList.Len() |
| | | if aTotal <= to { |
| | | aResult.CompareResult = (*aList)[from:aTotal] |
| | |
| | | return m |
| | | } |
| | | |
| | | func getTwiceSearchResult(co *service.CompareOnce, scopeIds *[]string) *service.CompareList{ |
| | | func getTwiceSearchResult(co *service.CompareOnce, scopeIds *[]string, searchBody *models.EsSearch) *service.CompareList{ |
| | | m := make(map[string]string) |
| | | for _,capId :=range *scopeIds { |
| | | m[capId] = capId |
| | | } |
| | | var totalData service.CompareList |
| | | for _,each :=range *co.CompareData { |
| | | if _,ok :=m[each.Id];ok{ |
| | | if _,ok :=m[each.Id];ok && each.CompareScore >= searchBody.Threshold { |
| | | totalData = append(totalData, each) |
| | | } |
| | | } |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 批量添加底库人员 |
| | | // @Description 依据图片批量添加底库人员 |
| | | // @Accept mpfd |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param files formData file[] true "多个底库人员图片" |
| | |
| | | } |
| | | extNames := make([]string, 0) |
| | | addResult := make(map[string]interface{}, 0) |
| | | successList := make([]string, 0) |
| | | successList := make([]string,0) |
| | | failList := make([]string,0) |
| | | noFaceList := make([]string,0) |
| | | multiFaceList := make([]string,0) |
| | | tAllStart := time.Now() |
| | | var wg sync.WaitGroup |
| | | var lock sync.Mutex |
| | |
| | | field, _, err1 := uploadFileReturnAddr(file, filename, tableId) |
| | | lock.Lock() |
| | | if err1 != nil || field == "" { |
| | | failList = append(failList, filename) |
| | | if err1 !=nil && err1.Error() == "NotFeatureFindError" { |
| | | noFaceList = append(noFaceList, filename) |
| | | } else if err1 !=nil && err1.Error() == "TooManyFaces" { |
| | | multiFaceList = append(multiFaceList, filename) |
| | | } else { |
| | | failList = append(failList, filename) |
| | | } |
| | | } else { |
| | | successList = append(successList, filename) |
| | | } |
| | |
| | | logger.Debug("切",len(fileHeaders),"张人脸用时:", time.Since(tAllStart)) |
| | | addResult["successList"] = successList |
| | | addResult["failList"] = failList |
| | | addResult["noFaceList"] = noFaceList |
| | | addResult["multiFaceList"] = multiFaceList |
| | | addResult["fields"] = extNames |
| | | |
| | | //if len(successList)>0 { |
| | | if len(successList)>0 { |
| | | util.ResponseFormat(c, code.DbPersonUploadSuccess, addResult) |
| | | //} else { |
| | | // util.ResponseFormat(c, code.DbPersonUploadFail, addResult) |
| | | //} |
| | | } else { |
| | | util.ResponseFormat(c, code.DbPersonUploadFail, addResult) |
| | | } |
| | | } |
| | | |
| | | type EsPersonSave struct { |
| | |
| | | // @Security ApiKeyAuth |
| | | // @Summary 上传图片 并切图 |
| | | // @Description 上传图片 并切图 |
| | | // @Accept mpfd |
| | | // @Accept multipart/form-data |
| | | // @Produce json |
| | | // @Tags dbperson 底库人员 |
| | | // @Param file formData file true "底库人员图片" |