-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PR] Implement building bipartite graph, calculate cost values of each edge, assign and make humans #42
Conversation
} | ||
return Human(keypoints: keypoints, lines: []) | ||
} | ||
} | ||
|
||
func parseAllPartOnMultiHuman(from output: TFLiteFlatArray<Float32>, with threshold: Float?) -> [Human] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend to divide 'parseAllPartOnMultiHuman' to tasks.
example)
func parseAllPartOnMultiHuman() {
...
makePair()
makeEdgesForEachPair()
merge()
makeHumans()
}
When you divide 'parseAllPartOnMultiHuman',
you have to make a tasks that have same abstract level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggestion is really important, but I'll refactoring on next PR soon.
|
||
// return [] | ||
// 5. Merging | ||
var tmpHumans: [[(col: Int, row: Int, val: Float32)?]] = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you possible, Don't use 'tmp'.
It's looks incomplete code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to change. thx :)
} | ||
|
||
guard let startingPartVertices = verticesForEachPart[startingPartIndex], | ||
let endingPartVertices = verticesForEachPart[endingPartIndex] else { fatalError("cannot get verties for assignment") } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can 'output.keypoints' return nil?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@syjdev
No. startingPartVertices
and endingPartVertices
type's element can be nil
. Because startingPartVertices
and endingPartVertices
are initialized with nil
in fixed size.
But it's weird... I'll change startingPartVertices
and endingPartVertices
to non-nil element array and try to remove the guard
statement.
👍
@@ -61,7 +61,9 @@ class OpenPosePoseEstimator: PoseEstimator { | |||
} | |||
|
|||
var pairNames: [String]? { | |||
return nil | |||
return Output.BodyPart.lines.map { | |||
return "\($0.from.shortName())-\($0.to.shortName())" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"($0.from.shortName())-($0.to.shortName())" is always String.
This expression never become Optional.
So, I recommend to use [String] for pairNames's type instead [String?].
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@syjdev
pairNames
property is defined on PoseEstimator
protocol as get-only.
There are 4 classes confirmed PoseEstimator
protocol:
PoseNetPoseEstimator
PEFMCPMPoseEstimator
PEFMHourglassPoseEstimator
OpenPosePoseEstimator
But OpenPosePoseEstimator
return non-nil array on pairNames
and others return nil
, because PoseNetPoseEstimator
, PEFMCPMPoseEstimator
, and PEFMHourglassPoseEstimator
don't support multi pose estimation.
// sampling | ||
let numberOfSamples = 10 | ||
let dx = Float(xDiff) / Float(numberOfSamples) | ||
let dy = Float(yDiff) / Float(numberOfSamples) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are types of xDiff, yDiff Float?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@syjdev
Oh, that's right. There is no need to cast.
} | ||
} | ||
|
||
edges.sort { $0.cost > $1.cost } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you sort edges twice. is this alright?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it was my mistake. Thx 👍
…g on post-processing step
…post-process of OpenPose
Related Issues
PR Points
OpenPosePoseEstimator.Output.BodyPart.lines
correctly1. NMS
#38
2. Bipartite Graph
3. Line Integral
ref
ref: wiki
4. Assignment
Sort by cost on a pair and perform assignment process.
In the following pair case, only 2 connections remain from 6 connection candidates.
5. Merging
Reference