Card: weights and model code verified against the official MODNet release
Browse files123456This repository contains a modified version of https://github.com/ZHKKKe/MODNet.Modifications by Meta Platforms, Inc.: conversion to the ExecuTorch program format (.pte) for theExecuTorch WebGPU backend, and quantization as described in README.md.The original work and these modifications are distributed under the license in LICENSE.123456This repository contains a modified version of https://github.com/ZHKKKe/MODNet.Modifications by Meta Platforms, Inc.: conversion to the ExecuTorch program format (.pte) for theExecuTorch WebGPU backend.The original work and these modifications are distributed under the license in LICENSE.
1 unmodified line2345674 unmodified lines12131415161718192021222324254 unmodified lines30313233343536373839404142434445464748491 unmodified linelicense: apache-2.0library_name: executorchpipeline_tag: image-segmentationtags:- executorch- webgpu4 unmodified linesThis repository contains an [ExecuTorch](https://github.com/pytorch/executorch) conversion ofhttps://github.com/ZHKKKe/MODNet for the ExecuTorch **WebGPU** backend, so the model runs entirely in a web browser onthe visitor's GPU. It powers the corresponding demo in theExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)).- **Base model:** https://github.com/ZHKKKe/MODNet- **Format:** ExecuTorch `.pte` programs delegated to the WebGPU backend- **Quantization:** fp32 (as exported)- **Total size:** 24.9 MB## Files| File | Size | SHA-256 |4 unmodified lines## Running itThese programs need the ExecuTorch WebGPU runtime compiled to WebAssembly([backends/webgpu](https://github.com/pytorch/executorch/tree/main/backends/webgpu)). The easiest way totry the model is the ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)),which downloads these files once, caches them in the browser, and runs everything locally.## Provenance- **Weights:** `boopathiraj/MODNet` @ `a967175f8fd63de67a1c161d8daac966d2b57e3a`, file `modnet/pretrained/modnet_photographic_portrait_matting.ckpt`, sha256 `7c22235f0925deba15d4d63e53afcb654c47055bbcd98f56e393ab2584007ed8` (from a community mirror of the official release)- **Exported with:** executorch 1.5.1+cpu, torch 2.14.1+cpu, torchao 0.18.0+cpu, transformers 5.19.0 (executorch git `3b6068392324`)- **Reproduce:** `python recipes/modnet.py --out out/modnet` (recipe in `export/`)- Re-running the recipe produces byte-identical files.## LicenseThis is a derivative of the upstream model and is distributed under the same terms(`apache-2.0`); see `LICENSE`.Modifications (conversion to the ExecuTorch format and quantization) by Meta Platforms, Inc.1 unmodified line23456784 unmodified lines1314151617181920212223242526272829303132333435363738394041424344454647484950514 unmodified lines565758596061626364656667686970717273747576777879808182838485868788899091921 unmodified linelicense: apache-2.0library_name: executorchpipeline_tag: image-segmentationinference: falsetags:- executorch- webgpu4 unmodified linesThis repository contains an [ExecuTorch](https://github.com/pytorch/executorch) conversion ofhttps://github.com/ZHKKKe/MODNet for the ExecuTorch **WebGPU** backend, so the model runs entirely in a web browser onthe visitor's GPU. It powers the corresponding demo in the ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)).- **Base model:** https://github.com/ZHKKKe/MODNet- **Format:** ExecuTorch `.pte` programs delegated to the WebGPU backend- **Quantization:** fp32 (as exported)- **Total size:** 24.9 MB## About the original modelA real-time portrait matting network that separates people from the background without a trimap.- **Developed by:** Zhanghan Ke et al.- **Paper:** [MODNet: Real-Time Trimap-Free Portrait Matting via Objective Decomposition](https://arxiv.org/abs/2011.11961)- 8.7M parameters in the released checkpoint- Photographic portrait matting checkpointFor training data, evaluation results and full details, see the original model card: https://github.com/ZHKKKe/MODNet.## Intended use and limitationsCutting people out of photos or camera frames, for example to blur or replace the background.Trained for portraits: results degrade on non-human subjects, several overlapping people, or unusual poses and lighting.## What changed in this conversion- Fixed 256x256 input; the matte is upsampled to the frame size outside the program## Inputs and outputs- Input `[1, 3, 256, 256]` float32 RGB normalized to [-1, 1]: `(x / 255 - 0.5) / 0.5`- Output `[1, 1, 256, 256]` float32 alpha matte in [0, 1]## Files| File | Size | SHA-256 |4 unmodified lines## Running itThese programs were exported with the ExecuTorch WebGPU backend([backends/webgpu](https://github.com/pytorch/executorch/tree/main/backends/webgpu)) and validated with theWebAssembly runtime build used by the ExecuTorch WebGPU Playground (launching soon on [executorch.ai](https://executorch.ai)). That runtime build is not published yet; until it is,the playground is the supported way to run them. It downloads these files once, caches them in the browser,and runs everything locally.Requirements: a browser with WebGPU enabled.## Provenance- **Weights:** `boopathiraj/MODNet` @ `a967175f8fd63de67a1c161d8daac966d2b57e3a`, file `modnet/pretrained/modnet_photographic_portrait_matting.ckpt`, sha256 `7c22235f0925deba15d4d63e53afcb654c47055bbcd98f56e393ab2584007ed8` (from a community mirror of the official release)- **Checked against the official checkpoint:** `modnet_photographic_portrait_matting.ckpt` is byte-identical to the official checkpoint linked from github.com/ZHKKKe/MODNet (sha256 `7c22235f0925deba15d4d63e53afcb654c47055bbcd98f56e393ab2584007ed8`), and the model code used for the export is identical to the official `src/models/` (one import path differs), checked by the project owner on 2026-10-16- **Exported with:** executorch 1.5.1+cpu, torch 2.14.1+cpu, torchao 0.18.0+cpu, transformers 5.19.0 (executorch git `3b6068392324`)- **Reproduce:** `python recipes/modnet.py --out out/modnet` (recipe in `export/`)- Re-running the recipe produces byte-identical files.## CitationIf you use this model, please cite the original work:```bibtex@inproceedings{ke2022modnet,title={MODNet: Real-Time Trimap-Free Portrait Matting via Objective Decomposition},author={Ke, Zhanghan and Sun, Jiayu and Li, Kaican and Yan, Qiong and Lau, Rynson W.H.},booktitle={AAAI},year={2022}}```## LicenseThis is a derivative of the upstream model and is distributed under the same terms(`apache-2.0`); see `LICENSE`.Modifications (conversion to the ExecuTorch format) by Meta Platforms, Inc.
NOTICE+1-1
README.md+50-7