Skip to content

Releases: WuChenDi/MODNet

Release list

v1.0.0

Choose a tag to compare

@WuChenDi WuChenDi released this 02 Jul 03:32

First tagged release. Self-contained ONNX export/inference pipeline running on current PyTorch 2.x, plus a Transformers.js example on the latest majors.

Highlights

  • Self-contained ONNX pipeline — the MobileNetV2 backbone from upstream ZHKKKe/MODNet (Apache-2.0) is vendored under src/, so export/inference no longer require the upstream repo checked out.
  • PyTorch 2.x support — runs on torch>=2.12 with CPU fallback; adds onnxscript (required by the 2.x exporter) and pins the legacy exporter (dynamo=False) so weights are embedded correctly (~25 MB) and dynamic_axes is honored.
  • Dropped SwanLab — the export/inference scripts use plain print; no mandatory account or network dependency.
  • Transformers.js v4examples/ upgraded to @huggingface/transformers 4 and typescript 6 (example code unchanged, type-checks clean).

Python / ONNX tooling (onnx_tools/)

  • CPU fallback and DataParallel-prefix stripping in export_onnx.py; --opset-version flag (default 17).
  • torch.load hardened with map_location + weights_only=True.
  • inference_onnx.py: explicit CPUExecutionProvider, clearer tensor layout, required path args.
  • Renamed onnx/ -> onnx_tools/ to stop the local package from shadowing the installed onnx library.

Dependencies

  • Python: torch>=2.12, torchvision>=0.27, onnxruntime>=1.23.2, numpy>=2.2, latest onnx/opencv/pillow, add onnxscript, drop swanlab.
  • JS/TS: @huggingface/transformers 3 -> 4, typescript 5 -> 6, tsx updated.

Docs

  • Rewritten onnx_tools/README.md (virtualenv + install steps, argument tables, "Notes for PyTorch 2.x export").
  • Root README.md entry point with a contents table and upstream credit; src/README.md attribution.

Verification

End-to-end export + inference on CPU: exported model ~24.76 MB (full weights), inference produces a valid alpha matte.