协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
onnx-and-browser【开发与工程】Export Segment Anything's prompt encoder and mask decoder to ONNX, quantize it, prepare matching image embeddings, and wire the model into ONNXRuntime or browser workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the user asks to export SAM to ONNX, quantize a SAM ONNX model, run the mask decoder in ONNXRuntime Web, prepare a .npy image embedding for a browser demo, or diagnose ONNX/browser input shape issues.
SamPredictor.predict, use ../prompted-segmentation/ unless ONNX export or embeddings are part of the request.SamAutomaticMaskGenerator, use ../automatic-mask-generation/.python sub-skills/onnx-and-browser/scripts/export_onnx_model.py --checkpoint sam_vit_h_4b8939.pth --model-type vit_h --output sam_onnx.onnx.--quantize-out sam_onnx_quantized.onnx; this requires onnxruntime because quantization uses ONNXRuntime tooling.scripts/prepare_embedding_template.py; save the .npy beside the browser image asset.image_embeddings, point_coords, point_labels, mask_input, has_mask_input, and orig_im_size.references/onnx-export.md explains export flags, tensor contracts, dynamic axes, quantization, and embedding compatibility.references/browser-demo.md explains browser asset layout, ONNXRuntime Web feeds, scaling, and SharedArrayBuffer headers.references/api-reference.md summarizes SamOnnxModel, export-script behavior, input/output names, and expected shapes.references/troubleshooting.md maps common export/runtime/browser errors to concrete fixes.scripts/export_onnx_model.py is an adapted export helper with safe --help behavior and clearer optional-dependency errors.scripts/prepare_embedding_template.py is a template for exporting a .npy image embedding from SamPredictor for ONNX/browser use.