The gmcnn-places2-tf
is the TensorFlow implementation of GMCNN Image Inpainting model,
aimed to estimate suitable pixel information to fill holes in images. gmcnn-places2-tf
is trained on Places2 dataset with free-form masks. Originally redistributed as checkpoint files,
it was converted to a frozen graph. For details see repository.
- Clone the original repository
git clone https://github.com/shepnerd/inpainting_gmcnn.git
cd inpainting_gmcnn/tensorflow
- Checkout the commit that the conversion was tested on:
git checkout ba7f710
- Apply
freeze_model.patch
patch
git apply path/to/freeze_model.patch
- Install the original dependencies. (TensorFlow* version used - 1.14.0, CPU).
- Download the pretrained weights
- Run sample conversion script:
python3 freeze_model.py --ckpt_dir path/to/downloaded_weights --save_dir path/to/save_directory
Metric | Value |
---|---|
Type | Image Inpainting |
GFlops | - |
MParams | - |
Source framework | TensorFlow* |
Accuracy metrics are obtained on 2000 image subset of VOC2012 dataset. Images were cropped to input size and disguised at random positions with pre-generated free-form masks.
Metric | Value |
---|---|
PSNR | 33.41dB |
-
Image, name:
Placeholder
, shape: [1x512x680x3], format: [BxHxWxC] where:- B - batch size
- H - image height
- W - image width
- C - number of channels
Expected color order: BGR.
-
Mask, name:
Placeholder_1
, shape: [1x512x680x1], format: [BxHxWxC] where:- B - batch size
- H - mask height
- W - mask width
- C - number of channels
-
Image, name:
Placeholder
, shape: [1x3x512x680], format: [BxCxHxW] where:- B - batch size
- C - number of channels
- H - image height
- W - image width
Expected color order: BGR.
-
Mask, name:
Placeholder_1
, shape: [1x1x512x680], format: [BxCxHxW] where:- B - batch size
- C - number of channels
- H - mask height
- W - mask width
Restored image, name Cast
, shape: [1x512x680x3], format: [BxHxWxC]
where:
- B - batch size
- H - image height
- W - image width
- C - number of channels
Expected color order: BGR.
Restored image, name: Cast
, shape: [1x3x512x680], format: [BxCxHxW]
where:
- B - batch size
- C - number of channels
- H - image height
- W - image width
Expected color order: BGR.
You can download models and if necessary convert them into Inference Engine format using the Model Downloader and other automation tools as shown in the examples below.
An example of using the Model Downloader:
python3 <omz_dir>/tools/downloader/downloader.py --name <model_name>
An example of using the Model Converter:
python3 <omz_dir>/tools/downloader/converter.py --name <model_name>
The original model is distributed under the following license:
MIT License
Copyright (c) 2018 yiwang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.