Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
video2motion: use the multiclass person segmenter
nirholas257691d760c2
diff --git a/workers/model-video2motion/Dockerfile b/workers/model-video2motion/Dockerfileindex 228a18ac5..c2e3e8ac4 100644--- a/workers/model-video2motion/Dockerfile+++ b/workers/model-video2motion/Dockerfile@@ -16,8 +16,8 @@ RUN pip install -r /app/requirements.txtRUN mkdir -p /models \&& curl -fsSL -o /models/pose_landmarker_heavy.task \https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_heavy/float16/latest/pose_landmarker_heavy.task \- && curl -fsSL -o /models/selfie_segmenter.task \- https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_segmenter/float16/latest/selfie_segmenter.task+ && curl -fsSL -o /models/selfie_multiclass_256x256.tflite \+ https://storage.googleapis.com/mediapipe-models/image_segmenter/selfie_multiclass_256x256/float32/latest/selfie_multiclass_256x256.tfliteWORKDIR /appCOPY worker_security.py /app/worker_security.pydiff --git a/workers/model-video2motion/main.py b/workers/model-video2motion/main.pyindex b48796458..9603e2921 100644--- a/workers/model-video2motion/main.py+++ b/workers/model-video2motion/main.py@@ -81,7 +81,7 @@ async def lifespan(app: FastAPI):_bucket = storage.Client().bucket(GCS_BUCKET)_sem = asyncio.Semaphore(MAX_CONCURRENT)# Fail fast if the model bundles are missing from the image.- for f in ("pose_landmarker_heavy.task", "selfie_segmenter.task"):+ for f in ("pose_landmarker_heavy.task", "selfie_multiclass_256x256.tflite"):path = os.path.join(MODELS_DIR, f)if not os.path.exists(path):raise RuntimeError(f"model bundle missing: {path}")@@ -259,9 +259,12 @@ def _analyze(video_path: str, fps: int):min_pose_detection_confidence=0.4,min_tracking_confidence=0.4,)+ # Multiclass person-part segmenter (background/hair/skin/face/clothes/other)+ # — the full-body person mask is 1 - background confidence, which holds up+ # far better than the selfie model on wide framing (house tours, rooms).seg_opts = vision.ImageSegmenterOptions(base_options=mp_python.BaseOptions(- model_asset_path=os.path.join(MODELS_DIR, "selfie_segmenter.task")+ model_asset_path=os.path.join(MODELS_DIR, "selfie_multiclass_256x256.tflite")),running_mode=vision.RunningMode.VIDEO,output_confidence_masks=True,@@ -311,8 +314,11 @@ def _analyze(video_path: str, fps: int):vis_frames.append(vis)seg_result = segmenter.segment_for_video(mp_image, ts_ms)- conf = seg_result.confidence_masks[0].numpy_view()- masks.append((np.clip(conf, 0.0, 1.0) * 255).astype(np.uint8))+ bg = seg_result.confidence_masks[0].numpy_view() # class 0 = background+ person = 1.0 - np.clip(bg, 0.0, 1.0)+ if person.shape != (height, width):+ person = cv2.resize(person, (width, height), interpolation=cv2.INTER_LINEAR)+ masks.append((person * 255).astype(np.uint8))frame_idx += 1cap.release()