mirror of
https://gitee.com/open-visual/face-search.git
synced 2025-07-10 19:37:01 +08:00
commit
857c3e155b
Binary file not shown.
@ -175,7 +175,7 @@ public class MilvusSearchEngine implements SearchEngine {
|
||||
SearchResultsWrapper wrapper = new SearchResultsWrapper(response.getData().getResults());
|
||||
for (int i = 0; i < features.length; ++i) {
|
||||
List<SearchDocument> documents = new ArrayList<>();
|
||||
List<SearchResultsWrapper.IDScore> scores = wrapper.GetIDScore(i);
|
||||
List<SearchResultsWrapper.IDScore> scores = wrapper.getIDScore(i);
|
||||
for(SearchResultsWrapper.IDScore scoreId : scores){
|
||||
long primaryKey = scoreId.getLongID();
|
||||
float score = scoreId.getScore();
|
||||
|
@ -86,9 +86,23 @@ public class FaceSearchServiceImpl extends BaseService implements FaceSearchServ
|
||||
}
|
||||
//结果和人数是否一致
|
||||
List<SearchResult> result = searchResponse.getResult();
|
||||
if(result.size() != faceInfos.size()){
|
||||
if(result.size() > 0 && result.size() != faceInfos.size()){
|
||||
throw new RuntimeException("search result error");
|
||||
}
|
||||
//如数据库中没有任何样本的情况下,会出现异常,这里进行单独处理
|
||||
if(result.size() == 0 && faceInfos.size() > 0){
|
||||
List<FaceSearchRepVo> vos = new ArrayList<>();
|
||||
for(int i=0; i<faceInfos.size(); i++) {
|
||||
FaceInfo.FaceBox box = faceInfos.get(i).box;
|
||||
FaceSearchRepVo vo = FaceSearchRepVo.build();
|
||||
vo.setLocation(FaceLocation.build(box.leftTop.x, box.leftTop.y, box.width(), box.height()));
|
||||
vo.setFaceScore((float) Math.floor(faceInfos.get(i).score * 1000000) / 10000);
|
||||
List<SampleFaceVo> match = new ArrayList<>();
|
||||
vo.setMatch(match);
|
||||
vos.add(vo);
|
||||
}
|
||||
return vos;
|
||||
}
|
||||
//获取关联数据ID
|
||||
boolean needFixFaceId = false;
|
||||
Set<Long> faceIds = new HashSet<>();
|
||||
|
@ -45,10 +45,10 @@ visual:
|
||||
engine:
|
||||
selected: milvus
|
||||
proxima:
|
||||
host: 172.16.36.229
|
||||
host: visual-face-search-proxima
|
||||
port: 16000
|
||||
milvus:
|
||||
host: 172.16.36.229
|
||||
host: visual-face-search-milvus
|
||||
port: 19530
|
||||
swagger:
|
||||
enable: true
|
||||
@ -72,9 +72,9 @@ spring:
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://172.16.36.228:3306/visual_face_search?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: model
|
||||
password: Model123!@#
|
||||
url: jdbc:mysql://visual-face-search-mysql:3306/visual_face_search?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: visual
|
||||
password: visual
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
|
@ -16,8 +16,10 @@ import org.apache.commons.codec.digest.DigestUtils;
|
||||
public class FaceSearchExample {
|
||||
|
||||
static{ nu.pattern.OpenCV.loadShared(); }
|
||||
|
||||
//本地开发模式
|
||||
public static String serverHost = "http://127.0.0.1:8080";
|
||||
//docker部署模式
|
||||
//public static String serverHost = "http://127.0.0.1:56789";
|
||||
public static String namespace = "namespace_1";
|
||||
public static String collectionName = "collect_20211201_v05";
|
||||
public static FaceSearch faceSearch = FaceSearch.build(serverHost, namespace, collectionName);
|
||||
|
@ -14,6 +14,8 @@ services:
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
volumes:
|
||||
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes-face-search/mysql:/var/lib/mysql
|
||||
ports:
|
||||
- "43306:3306"
|
||||
restart: always
|
||||
|
||||
visual-etcd:
|
||||
@ -46,15 +48,15 @@ services:
|
||||
|
||||
visual-milvus:
|
||||
container_name: face-search-milvus-standalone
|
||||
image: milvusdb/milvus:v2.0.0-rc8-20211104-d1f4106
|
||||
image: milvusdb/milvus:v2.0.1
|
||||
command: ["milvus", "run", "standalone"]
|
||||
environment:
|
||||
ETCD_ENDPOINTS: visual-etcd:2379
|
||||
MINIO_ADDRESS: visual-minio:9000
|
||||
volumes:
|
||||
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes-face-search/milvus:/var/lib/milvus
|
||||
# ports:
|
||||
# - "19530:19530"
|
||||
ports:
|
||||
- "19530:19530"
|
||||
depends_on:
|
||||
- "visual-etcd"
|
||||
- "visual-minio"
|
||||
|
Loading…
x
Reference in New Issue
Block a user