https://github.com/clibdev/modnet

MODNet in Pytorch and ONNX

https://github.com/clibdev/modnet

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (6.0%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

MODNet in Pytorch and ONNX

Basic Info
  • Host: GitHub
  • Owner: clibdev
  • License: apache-2.0
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 59.4 MB
Statistics
  • Stars: 5
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 1
Created about 3 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

Fork of ZHKKKe/MODNet

Differences between original repository and fork:

  • Compatibility with PyTorch >=2.5. (🔥)
  • Original pretrained models and converted ONNX models from GitHub releases page. (🔥)
  • Installation with requirements.txt file.
  • ONNX Simplifier integration in the export_onnx.py file.
  • Minor modifications in the inference.py file.
  • The following deprecations and errors has been fixed:
    • FutureWarning: You are using 'torch.load' with 'weights_only=False'.
    • AttributeError: module 'onnx' has no attribute 'loadfromstring'.

Installation

shell pip install -r requirements.txt

Pretrained models

  • Download links:

| Name | Model Size (MB) | Link | SHA-256 | |-----------------------|-----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------| | MODNet (Photographic) | 25.0
24.7 | PyTorch
ONNX | 7c22235f0925deba15d4d63e53afcb654c47055bbcd98f56e393ab2584007ed8
d381d71c0e85f0edc28df99a6dd59544b0c33cc2bf234b1fc22aa417fec127be | | MODNet (Webcam) | 25.0
24.7 | PyTorch
ONNX | 913b82b66558db39b6286c150f809017d7528c872b156eb14333c9c6cb52108b
52ace7b5c455f527542b496151996bed429b67ca8efc8bd793485a631363c688 |

Inference

shell python -m demo.image_matting.colab.inference --ckpt-path pretrained/modnet-photographic.pt --image-path data/images/test.jpg --output-path result.jpg

Export to ONNX format

shell pip install onnx onnxsim shell python -m onnx_model.export_onnx --ckpt-path pretrained/modnet-photographic.pt --output-path pretrained/modnet-photographic.onnx python -m onnx_model.export_onnx --ckpt-path pretrained/modnet-webcam.pt --output-path pretrained/modnet-webcam.onnx

ONNX inference

shell python -m onnx_model.inference_onnx --model-path pretrained/modnet-photographic.onnx --image-path data/images/test.jpg --output-path result.jpg

Owner

  • Login: clibdev
  • Kind: user

GitHub Events

Total
  • Push event: 1
Last Year
  • Push event: 1

Dependencies

demo/video_matting/custom/requirements.txt pypi
  • Pillow *
  • numpy *
  • opencv-python *
  • torch >=1.0.0
  • torchvision *
  • tqdm *
demo/video_matting/webcam/requirements.txt pypi
  • Pillow *
  • numpy *
  • opencv-python *
  • torch >=1.0.0
  • torchvision *
onnx_model/requirements.txt pypi
  • onnx ==1.8.1
  • onnxruntime ==1.6.0
  • opencv-python ==4.5.1.48
  • torch ==1.7.1
requirements.txt pypi
  • opencv-python >=4.8.0
  • scipy >=1.11.0
  • torch >=2.1.0
  • torchvision >=0.16.0
  • tqdm >=4.66.0