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 ce426275
authored
Jun 23, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
添加匹配数量
1 parent
8ef31fb8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
src/main/java/com/viontech/match/entity/vo/RequestVo.java
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/entity/vo/RequestVo.java
View file @
ce42627
...
...
@@ -42,6 +42,7 @@ public class RequestVo {
private
Person
person
;
private
String
personPoolId
;
private
List
<
String
>
unionPersonPoolId
;
private
Integer
size
;
private
FaceFeature
newFaceFeature
;
...
...
src/main/java/com/viontech/match/service/PersonService.java
View file @
ce42627
...
...
@@ -75,6 +75,7 @@ public class PersonService {
String
rid
=
requestVo
.
getRid
();
String
poolId
=
requestVo
.
getPersonPoolId
();
List
<
String
>
unionPersonPoolId
=
requestVo
.
getUnionPersonPoolId
();
Integer
size
=
requestVo
.
getSize
();
List
<
String
>
poolIds
=
new
ArrayList
<>();
List
<
Person
>
matchFaces
=
new
ArrayList
<>();
List
<
Person
>
matchBodies
=
new
ArrayList
<>();
...
...
@@ -93,9 +94,9 @@ public class PersonService {
pool
.
setPersonPoolId
(
id
);
if
(
poolService
.
existPool
(
id
))
{
pool
.
setStatus
(
0
);
List
<
Person
>
face
=
matchPerson
(
id
,
requestVo
.
getPerson
(),
0
);
List
<
Person
>
face
=
matchPerson
(
id
,
requestVo
.
getPerson
(),
0
,
size
);
matchFaces
.
addAll
(
face
);
List
<
Person
>
body
=
matchPerson
(
id
,
requestVo
.
getPerson
(),
1
);
List
<
Person
>
body
=
matchPerson
(
id
,
requestVo
.
getPerson
(),
1
,
size
);
matchBodies
.
addAll
(
body
);
}
else
{
pool
.
setStatus
(
1
);
...
...
@@ -249,16 +250,19 @@ public class PersonService {
* @return 匹配结果
* @throws Exception --
*/
public
List
<
Person
>
matchPerson
(
String
poolId
,
Person
person
,
int
type
)
throws
Exception
{
public
List
<
Person
>
matchPerson
(
String
poolId
,
Person
person
,
int
type
,
Integer
size
)
throws
Exception
{
List
<
Person
>
matchResult
=
new
ArrayList
<>();
int
matchResultSize
;
if
(
type
==
0
)
{
matchFace
(
poolId
,
matchResult
,
person
);
matchFace
(
poolId
,
matchResult
,
person
,
size
);
matchResultSize
=
Constant
.
FACE_MATCH_RESULT_SIZE
;
}
else
{
matchBody
(
poolId
,
matchResult
,
person
);
matchBody
(
poolId
,
matchResult
,
person
,
size
);
matchResultSize
=
Constant
.
BODY_MATCH_RESULT_SIZE
;
}
if
(
size
!=
null
)
{
matchResultSize
=
size
;
}
Stream
<
Person
>
stream
=
matchResult
.
stream
().
sorted
(
Comparator
.
comparingDouble
(
Person:
:
getScore
).
reversed
());
if
(
matchResult
.
size
()
>
matchResultSize
)
{
...
...
@@ -268,7 +272,7 @@ public class PersonService {
return
matchResult
;
}
private
void
matchFace
(
String
poolId
,
List
<
Person
>
matchResult
,
Person
person
)
throws
Exception
{
private
void
matchFace
(
String
poolId
,
List
<
Person
>
matchResult
,
Person
person
,
Integer
size
)
throws
Exception
{
List
<
FaceFeature
>
faceFeatures
=
person
.
getFaceFeatures
();
if
(
faceFeatures
!=
null
&&
faceFeatures
.
size
()
>
0
)
{
for
(
FaceFeature
faceFeature
:
faceFeatures
)
{
...
...
@@ -278,7 +282,7 @@ public class PersonService {
continue
;
}
SearchRequest
searchRequest
=
getSearchRequest
(
poolId
,
Constant
.
FACE_MATCH_RESULT_SIZE
,
feature
,
person
,
0
);
SearchRequest
searchRequest
=
getSearchRequest
(
poolId
,
size
==
null
?
Constant
.
FACE_MATCH_RESULT_SIZE
:
size
,
feature
,
person
,
0
);
matchResult
.
addAll
(
match0
(
searchRequest
));
}
}
else
{
...
...
@@ -286,7 +290,7 @@ public class PersonService {
}
}
private
void
matchBody
(
String
poolId
,
List
<
Person
>
matchResult
,
Person
person
)
throws
Exception
{
private
void
matchBody
(
String
poolId
,
List
<
Person
>
matchResult
,
Person
person
,
Integer
size
)
throws
Exception
{
List
<
BodyFeature
>
bodyFeatures
=
person
.
getBodyFeatures
();
if
(
bodyFeatures
!=
null
&&
bodyFeatures
.
size
()
>
0
)
{
for
(
BodyFeature
faceFeature
:
bodyFeatures
)
{
...
...
@@ -302,7 +306,7 @@ public class PersonService {
feature
=
Arrays
.
copyOfRange
(
feature
,
3
,
Constant
.
BODY_FEATURE_DIMS_2048
+
3
);
}
SearchRequest
searchRequest
=
getSearchRequest
(
poolId
,
Constant
.
BODY_MATCH_RESULT_SIZE
,
feature
,
person
,
1
);
SearchRequest
searchRequest
=
getSearchRequest
(
poolId
,
size
==
null
?
Constant
.
BODY_MATCH_RESULT_SIZE
:
size
,
feature
,
person
,
1
);
matchResult
.
addAll
(
match0
(
searchRequest
));
}
...
...
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