Source code for the paper Blind Visual Motif Removal from a Single Image.
Prerequisites
- Pytorch ≥ 0.4
- Coco pythonApi: for python 2.7 or for python 3 (optional for images datasets).
A pre-trained semi-transparent emojis removal model is available by running the script: demo / run_demo.py.
Start a training session, by run the file train / train_main.py.
Different training configurations are placed at the top.
Paths configurations
- root_path – the main data path.
- train_tag – your network name. The checkpoint folder will be named after this tag.
- cache_root - list of directories with prepared training and test images. See Create new Datasets section for more information.
Network configurations
- num_blocks – number of residual blocks between each layer.
- shared_depth – shared layers between the decoders.
- use_vm_decoder – If True, the network will contain a motif decoder branch.
The utils / visualize_utils.py script may assist in order to run a trained network on different images. The root_path and train_tag from above should be defined on top.
Images
The data_prep / coco_download.py script might be helpful to download a collection of images from Microsoft COCO dataset.
Text Motifs
The visual Motifs may be generated from a text file. examples of the text format are found at data / text folder or use
the split_text.py script on a row text file.
Create new Dataset
To create a training data use the file utils / cache_utils.py. In there you will define the dataset configurations:
- dataset_tag- name for the dataset
- images_root – path to a background images folder.
- cache_root- where should the data be saved.
- vm_root – path to the motifs dataset. May lead to:
- Motif image/s file or folder.
- Text file (.txt), as described at the previous item.