feat(v2): add fall event regression engine

This commit is contained in:
ila
2026-07-22 16:18:16 +08:00
parent 258fa49259
commit 1298369054
22 changed files with 1214 additions and 92 deletions
+10 -2
View File
@@ -8,6 +8,7 @@ import (
"os/exec"
"time"
"silverpose/v2/internal/pose"
"silverpose/v2/internal/spike"
)
@@ -41,7 +42,7 @@ func main() {
fail("decoded BGR frame has %d bytes, want %d; verify --width/--height", len(raw), expectedBytes)
}
input, err := spike.LetterboxBGRToNCHW(raw, *width, *height, 640)
input, transform, err := pose.PreprocessBGR(raw, *width, *height, 640)
if err != nil {
fail("preprocess frame: %v", err)
}
@@ -49,6 +50,10 @@ func main() {
if err != nil {
fail("run ONNX Pose: %v", err)
}
people, err := pose.ParseYOLOv8Pose(output, transform, 0.25, 0.70)
if err != nil {
fail("parse ONNX Pose: %v", err)
}
max := float32(0)
for _, value := range output {
@@ -56,7 +61,10 @@ func main() {
max = value
}
}
fmt.Printf("SPIKE_OK frame=%dx%d input=%d output=%d max=%.4f\n", *width, *height, len(input), len(output), max)
fmt.Printf("SPIKE_OK frame=%dx%d input=%d output=%d people=%d max=%.4f\n", *width, *height, len(input), len(output), len(people), max)
for index, person := range people {
fmt.Printf("PERSON index=%d conf=%.6f box=%.3f,%.3f,%.3f,%.3f\n", index, person.Confidence, person.Box.Left, person.Box.Top, person.Box.Right, person.Box.Bottom)
}
}
func fail(format string, args ...any) {