Home ONNX MST Image Inpainting
Post
Cancel

Open In GithubOpen In Github

Python scripts for performing Image Inpainting using the MST model in ONNX

!ONNX MST Image Inpainting

Original image: https://es.wikipedia.org/wiki/Archivo:Perro_Pipper_en_Merida_-_Pipperontour.jpg

Requirements

  • Check the requirements.txt file.
  • For ONNX, if you have a NVIDIA GPU, then install the onnxruntime-gpu, otherwise use the onnxruntime library.

Installation

:warning: Make sure to add the recursive when cloning

1
2
3
git clone https://github.com/ibaiGorordo/ONNX-MST-Image-Inpainting.git --recursive
cd ONNX-MST-Image-Inpainting
pip install -r requirements.txt

ONNX Runtime

For Nvidia GPU computers: pip install onnxruntime-gpu

Otherwise: pip install onnxruntime

ONNX model

Convert the model to ONNX using the Colab repository below and save it into the models folder

  • Convert MST Inpainting to ONNX Open In Colab
  • The License of the models is MIT: License

Examples

  • Image Inpainting (mask already available):
    1
    
     python image_inpaint.py.py
    
    • Sketch mask and Inpaint:
      1
      
       python sketch_and_inpaint.py.py
      

      !ONNX MST Image Inpainting with mask sketch

Mask Sketcher Usage

  • Left Mouse Button: Draw Mask
  • Middle/Wheel Mouse Button: Remove Mask
  • Bottom slider: Control mask drawing tool size
  • Press any key to stop sketching

https://user-images.githubusercontent.com/43162939/185775748-de6232e9-518a-45df-8de4-99902f1733c7.mp4

References:

This post is licensed under CC BY 4.0 by the author.