Skip to content
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

Merged
merged 8 commits into from
May 1, 2020
2 changes: 1 addition & 1 deletion PoseEstimation-TFLiteSwift.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@
712A7FC02424BDD800B043F9 /* StillImageLineViewController.swift */,
71A1ED4024574F2E001F796C /* StillImageHeatmapViewController.swift */,
7105C919241CE9B6001A4325 /* LiveImageViewController.swift */,
7105C929241D011F001A4325 /* View */,
7105C92B241D0150001A4325 /* MLModel */,
71DD577D2446D7A40024C146 /* Algorithm */,
7105C92A241D0144001A4325 /* Extension */,
7105C929241D011F001A4325 /* View */,
7105C938241D29C5001A4325 /* Video */,
7105C91E241CE9B7001A4325 /* Assets.xcassets */,
7105C920241CE9B7001A4325 /* LaunchScreen.storyboard */,
Expand Down
11 changes: 6 additions & 5 deletions PoseEstimation-TFLiteSwift/NonMaximumnonSuppression.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import Foundation

class NonMaximumnonSuppression {
typealias MaximumPoint = (row: Int, col: Int, val: Float32)
typealias MaximumPoint = (col: Int, row: Int, val: Float32)

static func process(_ heatmap: TFLiteFlatArray<Float32>, partIndex: Int, width: Int, height: Int) -> [MaximumPoint] {
let filterSize = 3
var lastMaximumColumns: [MaximumPoint?] = (0..<width).map { _ in nil }
var results: [MaximumPoint] = []
results.reserveCapacity(20)

for row in (0..<height) {
for col in (0..<width) {
Expand Down Expand Up @@ -48,8 +49,8 @@ class NonMaximumnonSuppression {
lastMaximumColumns[targetColumn] = nil
}
}
results.append((row: lastMaximumPoint.row,
col: lastMaximumPoint.col,
results.append((col: lastMaximumPoint.col,
row: lastMaximumPoint.row,
val: lastMaximumPoint.val))
}
}
Expand All @@ -66,8 +67,8 @@ class NonMaximumnonSuppression {
lastMaximumColumns[targetColumn] = nil
}
}
results.append((row: lastMaximumPoint.row,
col: lastMaximumPoint.col,
results.append((col: lastMaximumPoint.col,
row: lastMaximumPoint.row,
val: lastMaximumPoint.val))
}

Expand Down
Loading