Skip to content

yas-sim/interactive-image-inpainting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Interactive Image Inpainting Demo

This program demonstrates how the inpainting-gmcnn model works with the Intel(r) Distribution of OpenVINO(tm) toolkit.
The demo program takes an image file and displays it on the screen. The user can draw the mask image on top of the input image, then the program will treat the masked areas as they are lacking and inpaint (compensate) the image by deep learning based inferencing.
You can remove undesired objects from your picture by masking them and the program will generate a natural looking picture without the undesired objects.

これはIntel(r) Distribution of OpenVINO(tm) toolkitinpainting-gmcnn (画像修復モデル)を使用する方法をデモするプログラムです。
デモプログラムは画像を1枚読み込み、表示します。ユーザーが入力画像の上に自由にマスクを描画したのち、プログラムがマスク部分を欠損部分として扱い、欠損部分を補うようにディープラーニングでの推論を行い修復描画(Inpaint)してくれます。
絵の中の望ましくない部分(景色に写りこんだ柵や人など)をマスクすることで、それらを取り除いた自然な絵を生成してくれます(当然ですが限度があります:-) )。

Image Inpainting Result

inpainting1

inpainting2

Required DL Models to Run This Demo

The demo expects the following models in the Intermediate Representation (IR) format:

  • gmcnn-places2-tf

You can download this model from OpenVINO Open Model Zoo. In the models.lst is the list of appropriate models for this demo that can be obtained via Model downloader. Please see more information about Model downloader here.

How to Run

0. Prerequisites

  • OpenVINO 2020.2
    • If you haven't installed it, go to the OpenVINO web page and follow the Get Started guide to do it.

1. Install dependencies

The demo depends on:

  • opencv-python
  • numpy

To install all the required Python modules you can use:

(Linux) pip3 install -r requirements.txt
(Win10) pip install -r requirements.txt

2. Download DL models from OMZ

Use Model Downloader to download the required models and convert the downloaded model into OpenVINO IR models with Model Converter.

(Linux) python3 $INTEL_OPENVINO_DIR/deployment_tools/tools/model_downloader/downloader.py --list models.lst
        python3 $INTEL_OPENVINO_DIR/deployment_tools/tools/model_downloader/converter.py --list models.lst
       
(Win10) python "%INTEL_OPENVINO_DIR%\deployment_tools\tools\model_downloader\downloader.py" --list models.lst
        python "%INTEL_OPENVINO_DIR%\deployment_tools\tools\model_downloader\converter.py" --list models.lst

3. Run the demo app

(Linux) python3 image-inpainting.py <input_image_file>
(Win10) python image-inpainting.py <input_image_file>

Demo Output

The application draws the results on the screen.

Tested Environment

  • Windows 10 x64 1909 and Ubuntu 18.04 LTS
  • Intel(r) Distribution of OpenVINO(tm) toolkit 2021.3
  • Python 3.6.5 x64

See Also