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 ce7fe5c5
authored
Mar 03, 2021
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复人体匹配
1 parent
6cf8d7d7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
12 deletions
src/main/java/com/viontech/match/entity/vo/ResponseVo.java
src/main/java/com/viontech/match/service/PersonService.java
src/main/java/com/viontech/match/entity/vo/ResponseVo.java
View file @
ce7fe5c
...
...
@@ -32,6 +32,7 @@ public class ResponseVo {
private
Integer
match
;
private
List
<
PoolInfo
>
poolIds
;
private
List
<
Person
>
matchPersons
;
private
List
<
Person
>
matchBodies
;
public
ResponseVo
(
String
rid
)
{
this
.
rid
=
rid
;
...
...
src/main/java/com/viontech/match/service/PersonService.java
View file @
ce7fe5c
...
...
@@ -35,6 +35,7 @@ import javax.annotation.Resource;
import
java.io.IOException
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* .
...
...
@@ -61,7 +62,8 @@ public class PersonService {
String
poolId
=
requestVo
.
getPersonPoolId
();
List
<
String
>
unionPersonPoolId
=
requestVo
.
getUnionPersonPoolId
();
List
<
String
>
poolIds
=
new
ArrayList
<>();
List
<
Person
>
result
=
new
ArrayList
<>();
List
<
Person
>
matchFaces
=
new
ArrayList
<>();
List
<
Person
>
matchBodies
=
new
ArrayList
<>();
List
<
Pool
>
poolStatus
=
new
ArrayList
<>();
if
(
unionPersonPoolId
!=
null
&&
unionPersonPoolId
.
size
()
>
0
)
{
...
...
@@ -77,16 +79,21 @@ public class PersonService {
pool
.
setPersonPoolId
(
id
);
if
(
poolService
.
existPool
(
id
))
{
pool
.
setStatus
(
0
);
List
<
Person
>
people
=
matchPerson
(
id
,
requestVo
.
getPerson
());
result
.
addAll
(
people
);
List
<
Person
>
face
=
matchPerson
(
id
,
requestVo
.
getPerson
(),
0
);
matchFaces
.
addAll
(
face
);
List
<
Person
>
body
=
matchPerson
(
id
,
requestVo
.
getPerson
(),
1
);
matchBodies
.
addAll
(
body
);
}
else
{
pool
.
setStatus
(
1
);
}
poolStatus
.
add
(
pool
);
}
ResponseVo
success
=
ResponseVo
.
success
(
rid
,
"success"
);
if
(
result
.
size
()
>
0
)
{
success
.
setMatchPersons
(
result
);
if
(
matchFaces
.
size
()
>
0
)
{
success
.
setMatchPersons
(
matchFaces
);
}
if
(
matchBodies
.
size
()
>
0
)
{
success
.
setMatchBodies
(
matchBodies
);
}
success
.
setMatch
(
1
);
success
.
setPersonPoolStatus
(
poolStatus
);
...
...
@@ -194,18 +201,22 @@ public class PersonService {
}
public
List
<
Person
>
matchPerson
(
String
poolId
,
Person
person
)
throws
Exception
{
public
List
<
Person
>
matchPerson
(
String
poolId
,
Person
person
,
int
type
)
throws
Exception
{
List
<
Person
>
matchResult
=
new
ArrayList
<>();
List
<
FaceFeature
>
faceFeatures
=
person
.
getFaceFeatures
();
matchFace
(
faceFeatures
,
poolId
,
matchResult
);
List
<
BodyFeature
>
bodyFeatures
=
person
.
getBodyFeatures
();
matchBody
(
bodyFeatures
,
poolId
,
matchResult
);
if
(
type
==
0
)
{
List
<
FaceFeature
>
faceFeatures
=
person
.
getFaceFeatures
();
matchFace
(
faceFeatures
,
poolId
,
matchResult
);
}
else
{
List
<
BodyFeature
>
bodyFeatures
=
person
.
getBodyFeatures
();
matchBody
(
bodyFeatures
,
poolId
,
matchResult
);
}
Stream
<
Person
>
stream
=
matchResult
.
stream
().
sorted
(
Comparator
.
comparingInt
(
Person:
:
getScore
));
if
(
matchResult
.
size
()
>
Constant
.
MATCH_RESULT_SIZE
)
{
matchResult
=
matchResult
.
stream
().
sorted
(
Comparator
.
comparingInt
(
Person:
:
getScore
)).
limit
(
5
).
collect
(
Collectors
.
toList
()
);
stream
=
stream
.
limit
(
5
);
}
matchResult
=
stream
.
collect
(
Collectors
.
toList
());
return
matchResult
;
}
...
...
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