From 65a094bd57829118503802220b7125053c643c41 Mon Sep 17 00:00:00 2001
From: qvyuanxin <qvyuanxin@454eff88-639b-444f-9e54-f578c98de674>
Date: 星期二, 04 七月 2017 18:58:25 +0800
Subject: [PATCH]
---
FaceServer/STFaceCache.cpp | 48 ++++++++++++++++++++++++++++++++++--------------
1 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/FaceServer/STFaceCache.cpp b/FaceServer/STFaceCache.cpp
index 8ec96b1..52e3c69 100644
--- a/FaceServer/STFaceCache.cpp
+++ b/FaceServer/STFaceCache.cpp
@@ -347,7 +347,7 @@
stface_ctx_map_t& dbContext(*(stface_ctx_map_t*)_dbContext);
STFaceCacheContext& cacheContext(*(STFaceCacheContext*)_cacheContext);
- /*
+
for(stface_ctx_map_t::iterator iterCtx = dbContext.begin(); iterCtx != dbContext.end(); ++iterCtx)
{
STFaceDBContext& ctx(iterCtx->second);
@@ -372,28 +372,48 @@
for(top_idx_score_vect_t::iterator it = result.begin(); it != result.end(); ++it)
{
- if(topResult.empty())
- topResult.push_back(FDP_FaceDetectResult(ctx.dbid, it->idx, it->score * 1000));
-
int16_t new_confidence = it->score * 1000;
- 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)
- topResult.insert(rtTR, 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);
}
- */
+ /*
topResult.push_back(FDP_FaceDetectResult(1, 2, 3));
topResult.push_back(FDP_FaceDetectResult(-1, 2, 4));
topResult.push_back(FDP_FaceDetectResult(1, 6, 5));
- return FDP_FaceDetectResult(img.db_id, result[0].idx, result[0].score * 1000);
+ */
}
\ No newline at end of file
--
Gitblit v1.8.0