ml-sharp-web

bring-shrubbery活跃维护

在浏览器里用苹果 SHARP 模型把图片转成 3D 高斯泼溅,基于 ONNX 和 TypeScript 实现,无需本地环境即可在线体验。

Web playground to create Gaussian Splats using Apple's SHARP model

暂无版本300star10fork同步于 2026-11-10 12:02 UTC

怎么上手

由 README 提炼,执行前请确认
bun install
bun dev
硬件要求按 README 说明

README 未给出显存或 GPU 型号要求,只说明需要现代桌面浏览器(推荐 Chrome 或 Edge)、足够磁盘空间和内存,ONNX 模型文件约 2.4 GB;性能依赖浏览器 WebGPU/WASM 支持与机器可用内存。

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

在浏览器里用 Apple SHARP 模型把单张图片生成高斯泼溅并导出 ply 的网页工具

在浏览器里用苹果 SHARP 模型把图片转成 3D 高斯泼溅,基于 ONNX 和 TypeScript 实现,无需本地环境即可在线体验。

核心能力

  • 上传单张图片即可在浏览器内生成高斯泼溅
  • 用 ONNX Runtime Web worker 在浏览器端完成推理
  • 浏览器内做 NDC 到度量高斯转换并写出 PLY 文件
  • 用 GaussianSplats3D 在页面内实时预览结果
  • 支持导出 .ply 文件下载到本地

容易踩的坑

模型需先用 scripts/export_sharp_onnx.py 从 Apple SHARP 导出,且 .onnx 与 .onnx.data 两个文件必须放在同一目录一起提供,只上传 .onnx 通常无法工作;默认通过 Vite 在 http://localhost:5173 启动,需用 bun dev 而非 file:// 打开,否则 WASM 请求会返回 HTML 报错;使用 Apple 发布的权重需遵守 LICENSE_MODEL 的研究用途限制。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    ml-sharp-web

    ml-sharp-web preview

    A browser-based Gaussian splat generator built on top of Apple SHARP. ✨

    This project lets you:

    • upload one image
    • generate Gaussian splats in the browser
    • preview the result
    • download a .ply file

    Links

    Before you start (important license note)

    Apple's SHARP repository has separate licenses for code and model weights.

    If you use Apple's released SHARP checkpoint/weights, you must follow LICENSE_MODEL (research-use restrictions apply).

    What you need

    • Bun installed
    • A modern desktop browser (Chrome or Edge recommended)
    • Enough disk space and RAM for the SHARP model (the exported ONNX sidecar is large, ~2.4 GB)

    Quick start (run the app) 🚀

    1. Star this repo 🤩

    If this project helps you, please star it:

    2. Install dependencies

    bun install
    

    This also copies ONNX Runtime Web WASM assets into public/ort/ automatically.

    3. Start the app

    bun dev
    

    Open the URL shown by Vite (usually http://localhost:5173).

    4. Use the app

    1. Upload an image.
    2. Click Generate Splat.
    3. Preview the result and download the .ply file.

    Important model file note (.onnx + .onnx.data)

    SHARP exports usually produce two files:

    • sharp_web_predictor.onnx
    • sharp_web_predictor.onnx.data

    Both files must be served together from the same folder (for example public/models/).

    Why this matters:

    • The .onnx file is only the graph and metadata.
    • The .onnx.data file contains most of the model weights.

    For that reason, the app uses the hosted model by default. Uploading only the .onnx file directly in the browser usually will not work because the .onnx.data sidecar is separate.

    Export the SHARP model to ONNX (beginner-friendly steps)

    Everything runs in the browser, but you still need an exported SHARP ONNX model.

    1. Clone Apple's SHARP repo (reference code)

    git clone https://github.com/apple/ml-sharp /tmp/ml-sharp-upstream
    

    2. Prepare a Python environment for export

    You need Python + SHARP dependencies + ONNX export dependencies.

    The easiest route is to follow the upstream SHARP setup first, then run this exporter script from this repo.

    3. Export the browser predictor ONNX

    From this repo:

    python3 scripts/export_sharp_onnx.py \
      --sharp-repo /tmp/ml-sharp-upstream \
      --output public/models/sharp_web_predictor.onnx
    

    If the model is large (it is), the script will also write:

    public/models/sharp_web_predictor.onnx.data
    

    Optional export flags

    • --checkpoint /path/to/sharp_2572gikvuh.pt to use a manually downloaded checkpoint
    • --device cuda to export on GPU (if your environment supports it)
    • --opset 20 to change ONNX opset (default is 20)

    Static build (optional)

    If you want a static build instead of running bun dev:

    bun run build
    bun run preview
    

    Notes:

    • bun run build copies public/ into dist/, including the model files.
    • If sharp_web_predictor.onnx.data is present, the build output will be very large.

    How it works (high level)

    • React + TypeScript UI (src/)
    • ONNX Runtime Web worker for inference (src/workers/sharpWorker.ts)
    • Browser-side SHARP postprocessing (NDC -> metric gaussian conversion)
    • Browser-side PLY writer
    • In-page preview with @mkkellogg/gaussian-splats-3d

    Troubleshooting 🛠️

    "expected magic word ... found 3c 21 64 6f" (WASM error)

    This means a WASM file request returned HTML instead.

    Try:

    • run the app with bun dev (not file://...)
    • restart the dev server after bun install
    • verify these load in your browser:
      • /ort/ort-wasm-simd-threaded.asyncify.mjs
      • /ort/ort-wasm-simd-threaded.asyncify.wasm

    "Failed to load external data file ... sharp_web_predictor.onnx.data"

    This means the ONNX sidecar file is missing or not served correctly.

    Check:

    • public/models/sharp_web_predictor.onnx
    • public/models/sharp_web_predictor.onnx.data
    • The app can reach the hosted model files in your deployment/browser environment

    The app runs, but generation is very slow or crashes

    SHARP is large and browser inference is heavy.

    Try:

    • Chrome or Edge (desktop)
    • smaller Max gaussians in the UI
    • closing other memory-heavy tabs/apps
    • waiting longer on first run (model + runtime initialization can take time)

    Tech stack

    Project status

    Working prototype / experimental. 🧪

    The app runs end-to-end in the browser, but performance and compatibility depend heavily on browser WebGPU/WASM support and your machine's available memory.