Skip to content

Commit

Permalink
update thresholds
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyangXYZ committed Sep 18, 2024
1 parent 09efbd6 commit 37db713
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/MMDScene.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ function MMDScene({ pose, setFps }: { pose: NormalizedLandmark[] | null; setFps:
return
}

const lerpFactor = 0.4
const lerpFactor = 0.5
const scale = 10
const yOffset = 8

const visibilityThreshold = 0.5
const keypointIndexByName: { [key: string]: number } = {
nose: 0,
left_eye_inner: 1,
Expand Down Expand Up @@ -146,7 +146,7 @@ function MMDScene({ pose, setFps }: { pose: NormalizedLandmark[] | null; setFps:
}
const getKeypoint = (name: string): Vector3 | null => {
const point = pose[keypointIndexByName[name]]
return new Vector3(point.x, point.y, point.z)
return point.visibility > visibilityThreshold ? new Vector3(point.x, point.y, point.z) : null
}
const getBone = (name: string): IMmdRuntimeLinkedBone | undefined => {
return mmdModel!.skeleton.bones.find((bone) => bone.name === name)
Expand Down
6 changes: 4 additions & 2 deletions src/Video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ function Video({ setPose }: { setPose: (pose: NormalizedLandmark[]) => void }):
delegate: "GPU",
},
runningMode: "VIDEO",
minPoseDetectionConfidence: 0.95,
minTrackingConfidence: 0.95,
minPosePresenceConfidence: 0.7,
minPoseDetectionConfidence: 0.7,
minTrackingConfidence: 0.7,
outputSegmentationMasks: false,
})
let lastTime = performance.now()
const detect = () => {
Expand Down

0 comments on commit 37db713

Please sign in to comment.