feat: negative points for breath
This commit is contained in:
+13
-3
@@ -256,12 +256,22 @@ export async function autoSegment() {
|
||||
});
|
||||
|
||||
const poseLandmarks = poseLandmarker.detect(image).landmarks[0];
|
||||
const breathX =
|
||||
const positiveBreathX =
|
||||
((poseLandmarks[11].x + poseLandmarks[12].x) / 2) * imageSize.val.width;
|
||||
const breathY =
|
||||
const positiveBreathY =
|
||||
((poseLandmarks[11].y + poseLandmarks[12].y) / 2) * imageSize.val.height;
|
||||
const negativeBreathX1 = poseLandmarks[0].x * imageSize.val.width;
|
||||
const negativeBreathY1 = poseLandmarks[0].y * imageSize.val.height;
|
||||
const negativeBreathX2 = poseLandmarks[9].x * imageSize.val.width;
|
||||
const negativeBreathY2 = poseLandmarks[9].y * imageSize.val.height;
|
||||
const negativeBreathX3 = poseLandmarks[10].x * imageSize.val.width;
|
||||
const negativeBreathY3 = poseLandmarks[10].y * imageSize.val.height;
|
||||
|
||||
imagePromptsMulti.val["breath"] = [
|
||||
{ x: breathX, y: breathY, label: 1, isAuto: true },
|
||||
{ x: positiveBreathX, y: positiveBreathY, label: 1, isAuto: true },
|
||||
{ x: negativeBreathX1, y: negativeBreathY1, label: 0, isAuto: true },
|
||||
{ x: negativeBreathX2, y: negativeBreathY2, label: 0, isAuto: true },
|
||||
{ x: negativeBreathX3, y: negativeBreathY3, label: 0, isAuto: true },
|
||||
];
|
||||
imagePrompts.val = imagePromptsMulti.val[selectedLayer.val];
|
||||
segmented.val = true;
|
||||
|
||||
+18
-3
@@ -241,9 +241,24 @@ class SAMMultiLayer:
|
||||
boxesMulti[key] = box
|
||||
|
||||
if pose_landmarks is not None:
|
||||
breathX = ((pose_landmarks[11].x + pose_landmarks[12].x) / 2) * W
|
||||
breathY = ((pose_landmarks[11].y + pose_landmarks[12].y) / 2) * H
|
||||
imagePromptsMulti["breath"] = [{"x": breathX, "y": breathY, "label": 1}]
|
||||
positiveBreathX = (
|
||||
(pose_landmarks[11].x + pose_landmarks[12].x) / 2
|
||||
) * W
|
||||
positiveBreathY = (
|
||||
(pose_landmarks[11].y + pose_landmarks[12].y) / 2
|
||||
) * H
|
||||
negativeBreathX1 = pose_landmarks[0].x * W
|
||||
negativeBreathY1 = pose_landmarks[0].y * H
|
||||
negativeBreathX2 = pose_landmarks[9].x * W
|
||||
negativeBreathY2 = pose_landmarks[9].y * H
|
||||
negativeBreathX3 = pose_landmarks[10].x * W
|
||||
negativeBreathY3 = pose_landmarks[10].y * H
|
||||
imagePromptsMulti["breath"] = [
|
||||
{"x": positiveBreathX, "y": positiveBreathY, "label": 1},
|
||||
{"x": negativeBreathX1, "y": negativeBreathY1, "label": 0},
|
||||
{"x": negativeBreathX2, "y": negativeBreathY2, "label": 0},
|
||||
{"x": negativeBreathX3, "y": negativeBreathY3, "label": 0},
|
||||
]
|
||||
|
||||
return imagePromptsMulti, boxesMulti
|
||||
|
||||
|
||||
Reference in New Issue
Block a user