From d61e1dda9ead8968665a62dffff1babc93fdc99b Mon Sep 17 00:00:00 2001 From: lihongtao <lihongtao@454eff88-639b-444f-9e54-f578c98de674> Date: 星期一, 03 七月 2017 14:13:52 +0800 Subject: [PATCH] --- FaceServer/STFaceCache.cpp | 45 ++++++++++++++++++++++++++++++--------------- FaceServer/make.sh | 3 ++- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/FaceServer/STFaceCache.cpp b/FaceServer/STFaceCache.cpp index 9ed8e7b..52e3c69 100644 --- a/FaceServer/STFaceCache.cpp +++ b/FaceServer/STFaceCache.cpp @@ -374,23 +374,38 @@ { int16_t new_confidence = it->score * 1000; - if(topResult.empty()) - topResult.push_back(FDP_FaceDetectResult(ctx.dbid, it->idx, new_confidence)); - - - else if(new_confidence > topResult.rbegin()->confidence) + fdr_vec_t::reverse_iterator rtTR = topResult.rbegin(); + if(!topResult.empty()) { - while(topResult.size() > 4) - topResult.pop_back(); - for(fdr_vec_t::reverse_iterator rtTR = topResult.rbegin() + 1; rtTR != topResult.rend(); ++rtTR) - { - if(new_confidence < rtTR->confidence) - { - fdr_vec_t::iterator itTR(rtTR.base()); - topResult.insert(itTR, FDP_FaceDetectResult(ctx.dbid, it->idx, new_confidence)); - } - } + while(new_confidence > rtTR->confidence) + ++rtTR; } + + fdr_vec_t::iterator itTR(rtTR.base()); + topResult.insert(itTR, FDP_FaceDetectResult(ctx.dbid, it->idx, new_confidence)); + + + while(topResult.size() > 5) + topResult.pop_back(); + + + //if(topResult.empty()) + // topResult.push_back(FDP_FaceDetectResult(ctx.dbid, it->idx, new_confidence)); + // + // + //else if(new_confidence > topResult.rbegin()->confidence) + //{ + // while(topResult.size() > 4) + // topResult.pop_back(); + // for(fdr_vec_t::reverse_iterator rtTR = topResult.rbegin() + 1; rtTR != topResult.rend(); ++rtTR) + // { + // if(new_confidence < rtTR->confidence) + // { + // fdr_vec_t::iterator itTR(rtTR.base()); + // topResult.insert(itTR, FDP_FaceDetectResult(ctx.dbid, it->idx, new_confidence)); + // } + // } + //} } //LOGP(INFO, "stface_search_db return dbid=%d, idx=%d, score=%f", img.db_id, result[0].idx, result[0].score); diff --git a/FaceServer/make.sh b/FaceServer/make.sh index c0f28cd..f24a3c0 100644 --- a/FaceServer/make.sh +++ b/FaceServer/make.sh @@ -24,7 +24,7 @@ LDFLAGS+="-pthread -levent $PROTOBUF_LIB $STFACESDK_LIB $OPENCV_LIB $LIBYUV_LIB " rm *.o -rm face_server test_client_detect test_client_add test_client_search +rm face_server test_client_detect test_client_add test_client_compare test_client_search g++ $PIPELINE_BASE/Logger/src/logger.cc $CFLAGS $CPPFLAGS g++ ev_server.cpp -DUSER_DEFINE_EVCLIENT_PROC $CFLAGS $CPPFLAGS @@ -72,3 +72,4 @@ # #export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/protobuf/inst/lib:/opt/opencv/inst/lib:/opt/st_face/libs/linux-x86_64 +#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/protobuf/inst/lib:/opt/opencv/inst/lib:/opt/st_face/libs/linux-x86_64:/opt/opencv/lib -- Gitblit v1.8.0