Skip to content

Commit

Permalink
add mediapipe links and options
Browse files Browse the repository at this point in the history
  • Loading branch information
eyaler committed Jun 2, 2024
1 parent 05e2c2f commit db06bf9
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,24 +275,34 @@ async function capture() {
}

const vision = await FilesetResolver.forVisionTasks('https://cdn.jsdelivr.net/npm/@mediapipe/[email protected]/wasm')

// https://ai.google.dev/edge/mediapipe/solutions/vision/pose_landmarker/web_js
const poseLandmarker = await PoseLandmarker.createFromOptions(
vision,
{
baseOptions: {
modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/1/pose_landmarker_lite.task',
modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_lite/float16/latest/pose_landmarker_lite.task',
// modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_full/float16/latest/pose_landmarker_full.task',
// modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_heavy/float16/latest/pose_landmarker_heavy.task',
delegate: 'GPU'
},
runningMode: 'VIDEO',
numPoses: 2
numPoses: 2,
minPoseDetectionConfidence: .5,
minPosePresenceConfidence: .5,
minTrackingConfidence: .5,
})

// https://ai.google.dev/edge/mediapipe/solutions/vision/image_segmenter/web_js
const imageSegmenter = await ImageSegmenter.createFromOptions(
vision, {
baseOptions: {
modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/image_segmenter/deeplab_v3/float32/1/deeplab_v3.tflite',
modelAssetPath: 'https://storage.googleapis.com/mediapipe-models/image_segmenter/deeplab_v3/float32/latest/deeplab_v3.tflite',
delegate: 'GPU'
},
runningMode: 'VIDEO',
})

const models = {'pose': poseLandmarker, 'segment': imageSegmenter}
const canvasCtx = canvas.getContext('2d');
const drawingUtils = new DrawingUtils(canvasCtx);
Expand Down

0 comments on commit db06bf9

Please sign in to comment.