Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
VVAS-Match
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit fa91890d
authored
Oct 16, 2024
by
朱海
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
[chg]人员库支持不同的比对分数
1 parent
b7916465
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
6 deletions
src/main/java/com/viontech/match/entity/PersonInfo.java
src/main/java/com/viontech/match/entity/SearchResultHit.java
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/entity/PersonInfo.java
View file @
fa91890
...
...
@@ -22,8 +22,9 @@ public class PersonInfo {
private
String
channelSerialNum
;
private
Long
gateId
;
private
String
direction
;
private
Long
personType
;
public
PersonInfo
(
String
unid
,
String
personId
,
Double
[]
body
,
Double
[]
data
,
Integer
age
,
String
gender
,
Integer
bodyType
,
Date
countTime
,
String
fid
,
String
channelSerialNum
,
Long
gateId
,
String
direction
)
{
public
PersonInfo
(
String
unid
,
String
personId
,
Double
[]
body
,
Double
[]
data
,
Integer
age
,
String
gender
,
Integer
bodyType
,
Date
countTime
,
String
fid
,
String
channelSerialNum
,
Long
gateId
,
String
direction
,
Long
personType
)
{
this
.
unid
=
unid
;
this
.
personId
=
personId
;
this
.
body
=
body
;
...
...
@@ -37,5 +38,6 @@ public class PersonInfo {
this
.
gateId
=
gateId
;
this
.
direction
=
direction
;
this
.
_score
=
"1"
;
this
.
personType
=
personType
;
}
}
src/main/java/com/viontech/match/entity/SearchResultHit.java
View file @
fa91890
...
...
@@ -23,4 +23,5 @@ public class SearchResultHit {
private
String
channelSerialNum
;
private
Long
gateId
;
private
String
direction
;
private
Long
personType
;
}
src/main/java/com/viontech/match/service/PersonService.java
View file @
fa91890
...
...
@@ -49,7 +49,7 @@ import java.util.stream.Stream;
@Service
@Slf4j
public
class
PersonService
{
private
static
final
String
[]
FETCH_SOURCE
=
new
String
[]{
"personId"
,
"age"
,
"gender"
,
"fid"
,
"counttime"
,
"channelSerialNum"
,
"body_type"
,
"unid"
};
private
static
final
String
[]
FETCH_SOURCE
=
new
String
[]{
"personId"
,
"age"
,
"gender"
,
"fid"
,
"counttime"
,
"channelSerialNum"
,
"body_type"
,
"unid"
,
"personType"
};
@Resource
private
ElasticsearchClient
client
;
...
...
@@ -257,6 +257,7 @@ public class PersonService {
String
direction
=
person
.
getDirection
();
//Long gateId = person.getGateId();
Integer
bodyType
=
person
.
getBodyType
();
Long
personType
=
person
.
getPersonType
();
String
personChannelSerialNum
=
person
.
getChannelSerialNum
();
List
<
FaceFeature
>
faceFeatures
=
person
.
getFaceFeatures
();
if
(
CollectionUtils
.
isNotEmpty
(
faceFeatures
))
{
...
...
@@ -273,7 +274,7 @@ public class PersonService {
// "counttime", personCountTime == null ? null : Constant.DATE_FORMAT.get().format(personCountTime),
// "channelSerialNum", personChannelSerialNum, "gateId", gateId, "direction", direction);
// bulkRequest.add(indexRequest);
operationList
.
add
(
new
BulkOperation
.
Builder
().
index
(
new
IndexOperation
.
Builder
<
PersonInfo
>().
index
(
poolId
).
document
(
new
PersonInfo
(
unid
,
personId
,
feature
,
null
,
age
,
gender
,
bodyType
,
personCountTime
,
fid
,
personChannelSerialNum
,
gateId
,
direction
)).
build
()).
build
());
operationList
.
add
(
new
BulkOperation
.
Builder
().
index
(
new
IndexOperation
.
Builder
<
PersonInfo
>().
index
(
poolId
).
document
(
new
PersonInfo
(
unid
,
personId
,
feature
,
null
,
age
,
gender
,
bodyType
,
personCountTime
,
fid
,
personChannelSerialNum
,
gateId
,
direction
,
personType
)).
build
()).
build
());
}
}
}
...
...
@@ -303,7 +304,7 @@ public class PersonService {
// "counttime", counttime == null ? null : Constant.DATE_FORMAT.get().format(counttime)
// , "channelSerialNum", channelSerialNum, "gateId", gateId, "direction", direction);
// bulkRequest.add(indexRequest);
operationList
.
add
(
new
BulkOperation
.
Builder
().
index
(
new
IndexOperation
.
Builder
<
PersonInfo
>().
index
(
poolId
).
document
(
new
PersonInfo
(
unid
,
personId
,
feature
,
null
,
age
,
gender
,
bodyType
,
personCountTime
,
fid
,
personChannelSerialNum
,
gateId
,
direction
)).
build
()).
build
());
operationList
.
add
(
new
BulkOperation
.
Builder
().
index
(
new
IndexOperation
.
Builder
<
PersonInfo
>().
index
(
poolId
).
document
(
new
PersonInfo
(
unid
,
personId
,
feature
,
null
,
age
,
gender
,
bodyType
,
personCountTime
,
fid
,
personChannelSerialNum
,
gateId
,
direction
,
personType
)).
build
()).
build
());
}
}
}
...
...
@@ -537,11 +538,19 @@ public class PersonService {
}
else
{
// builder.size(matchResultSize);
}
Float
matchScore
=
null
;
Map
<
String
,
Float
>
poolMatchScoreMap
=
person
.
getPoolMatchScoreMap
();
if
(
poolMatchScoreMap
!=
null
)
{
matchScore
=
poolMatchScoreMap
.
get
(
poolId
);
}
if
(
matchScore
==
null
)
{
matchScore
=
person
.
getBodyMinScore
();
}
SourceConfig
sourceConfig
=
new
SourceConfig
.
Builder
().
filter
(
s
->
s
.
includes
(
Arrays
.
asList
(
FETCH_SOURCE
))).
build
();
// log.debug("rid:{} poolId:{} 匹配时参数:{}", rid, poolId, scriptScoreQuery.toString());
// KnnSearch knnQuery = getKnnSearch(feature, person, type);
// ScriptScoreQuery scriptScoreQuery = getScriptScoreQuery(feature, person, type);
return
new
SearchRequest
.
Builder
().
index
(
poolId
).
query
(
scriptScoreQuery
).
source
(
sourceConfig
).
size
(
matchResultSize
).
minScore
(
person
.
getBodyMinScore
()
.
doubleValue
()/
100
).
build
();
return
new
SearchRequest
.
Builder
().
index
(
poolId
).
query
(
scriptScoreQuery
).
source
(
sourceConfig
).
size
(
matchResultSize
).
minScore
(
matchScore
.
doubleValue
()/
100
).
build
();
}
private
List
<
Person
>
match0
(
SearchRequest
searchRequest
,
Boolean
agg
)
throws
Exception
{
...
...
@@ -574,7 +583,7 @@ public class PersonService {
p
.
setChannelSerialNum
(
hit
.
getChannelSerialNum
());
p
.
setBodyType
(
hit
.
getBodyType
());
p
.
setCaptureUnid
(
hit
.
getUnid
());
p
.
setPersonType
(
hit
.
getPersonType
());
p
.
setCounttime
(
Optional
.
ofNullable
((
String
)
hit
.
getCounttime
())
.
map
(
x
->
{
try
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment