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());
|
SearchResultsWrapper wrapper = new SearchResultsWrapper(response.getData().getResults());
|
||||||
for (int i = 0; i < features.length; ++i) {
|
for (int i = 0; i < features.length; ++i) {
|
||||||
List<SearchDocument> documents = new ArrayList<>();
|
List<SearchDocument> documents = new ArrayList<>();
|
||||||
List<SearchResultsWrapper.IDScore> scores = wrapper.GetIDScore(i);
|
List<SearchResultsWrapper.IDScore> scores = wrapper.getIDScore(i);
|
||||||
for(SearchResultsWrapper.IDScore scoreId : scores){
|
for(SearchResultsWrapper.IDScore scoreId : scores){
|
||||||
long primaryKey = scoreId.getLongID();
|
long primaryKey = scoreId.getLongID();
|
||||||
float score = scoreId.getScore();
|
float score = scoreId.getScore();
|
||||||
|
@ -86,9 +86,23 @@ public class FaceSearchServiceImpl extends BaseService implements FaceSearchServ
|
|||||||
}
|
}
|
||||||
//结果和人数是否一致
|
//结果和人数是否一致
|
||||||
List<SearchResult> result = searchResponse.getResult();
|
List<SearchResult> result = searchResponse.getResult();
|
||||||
if(result.size() != faceInfos.size()){
|
if(result.size() > 0 && result.size() != faceInfos.size()){
|
||||||
throw new RuntimeException("search result error");
|
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
|
//获取关联数据ID
|
||||||
boolean needFixFaceId = false;
|
boolean needFixFaceId = false;
|
||||||
Set<Long> faceIds = new HashSet<>();
|
Set<Long> faceIds = new HashSet<>();
|
||||||
|
@ -45,10 +45,10 @@ visual:
|
|||||||
engine:
|
engine:
|
||||||
selected: milvus
|
selected: milvus
|
||||||
proxima:
|
proxima:
|
||||||
host: 172.16.36.229
|
host: visual-face-search-proxima
|
||||||
port: 16000
|
port: 16000
|
||||||
milvus:
|
milvus:
|
||||||
host: 172.16.36.229
|
host: visual-face-search-milvus
|
||||||
port: 19530
|
port: 19530
|
||||||
swagger:
|
swagger:
|
||||||
enable: true
|
enable: true
|
||||||
@ -72,9 +72,9 @@ spring:
|
|||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://172.16.36.228:3306/visual_face_search?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://visual-face-search-mysql:3306/visual_face_search?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: model
|
username: visual
|
||||||
password: Model123!@#
|
password: visual
|
||||||
slave:
|
slave:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
enabled: false
|
enabled: false
|
||||||
|
@ -16,8 +16,10 @@ import org.apache.commons.codec.digest.DigestUtils;
|
|||||||
public class FaceSearchExample {
|
public class FaceSearchExample {
|
||||||
|
|
||||||
static{ nu.pattern.OpenCV.loadShared(); }
|
static{ nu.pattern.OpenCV.loadShared(); }
|
||||||
|
//本地开发模式
|
||||||
public static String serverHost = "http://127.0.0.1:8080";
|
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 namespace = "namespace_1";
|
||||||
public static String collectionName = "collect_20211201_v05";
|
public static String collectionName = "collect_20211201_v05";
|
||||||
public static FaceSearch faceSearch = FaceSearch.build(serverHost, namespace, collectionName);
|
public static FaceSearch faceSearch = FaceSearch.build(serverHost, namespace, collectionName);
|
||||||
|
@ -14,6 +14,8 @@ services:
|
|||||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||||
volumes:
|
volumes:
|
||||||
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes-face-search/mysql:/var/lib/mysql
|
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes-face-search/mysql:/var/lib/mysql
|
||||||
|
ports:
|
||||||
|
- "43306:3306"
|
||||||
restart: always
|
restart: always
|
||||||
|
|
||||||
visual-etcd:
|
visual-etcd:
|
||||||
@ -46,15 +48,15 @@ services:
|
|||||||
|
|
||||||
visual-milvus:
|
visual-milvus:
|
||||||
container_name: face-search-milvus-standalone
|
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"]
|
command: ["milvus", "run", "standalone"]
|
||||||
environment:
|
environment:
|
||||||
ETCD_ENDPOINTS: visual-etcd:2379
|
ETCD_ENDPOINTS: visual-etcd:2379
|
||||||
MINIO_ADDRESS: visual-minio:9000
|
MINIO_ADDRESS: visual-minio:9000
|
||||||
volumes:
|
volumes:
|
||||||
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes-face-search/milvus:/var/lib/milvus
|
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes-face-search/milvus:/var/lib/milvus
|
||||||
# ports:
|
ports:
|
||||||
# - "19530:19530"
|
- "19530:19530"
|
||||||
depends_on:
|
depends_on:
|
||||||
- "visual-etcd"
|
- "visual-etcd"
|
||||||
- "visual-minio"
|
- "visual-minio"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user