Giter VIP home page Giter VIP logo

informative-drawings's Introduction

Informative Drawings: Learning to generate line drawings that convey geometry and semantics

Setup

Clone this repository

git clone https://github.com/carolineec/informative-drawings.git
cd informative-drawings

Install dependencies

We provide an environment.yml file listing the dependences and to create a conda environment. Our model uses Pytorch 1.7.1

conda env create -f environment.yml
conda activate drawings

Use the following command to install CLIP (only needed for training).

conda activate drawings
pip install git+https://github.com/openai/CLIP.git

Testing

Pre-trained model is available here, place the model weights in checkpoints.

cd checkpoints
unzip model.zip

run pre-trained model on images in --dataroot. Replace examples with the folder path containing your input images.

python test.py --name anime_style --dataroot examples/test

Results will be saved to the results directory by default. You can change the save location by specifying the file path with --results_dir.

Training

We provide a pre-trained network for mapping ImageNet features into depth images here. Place the pre-trained features to depth network in the ./checkpoints/feats2Geom folder.

cd checkpoints/feats2Geom
unzip feats2depth.zip

To train a model with name myexperiment from scratch use the following command.

python train.py --name myexperiment \
--dataroot examples/train/photos \
--depthroot examples/train/depthmaps \
--root2 examples/train/drawings \
--no_flip

Replace the example data examples/train/photos, examples/train/depthmaps, and examples/train/drawings with the paths to the dataset of photographs, depth maps, and line drawings respectively. Corresponding images and depth maps in the file paths specified by --dataroot and --depthroot should have the same file names. You will also need to specify a path to an unaligned dataset of line drawings with --root2. A small example of training data is provided in examples/train.

Because the model can start making grayscale photos after some training, it is recommended to save model checkpoints frequently by adding the flag --save_epoch_freq 1.

Depth Maps

For training, geometry supervision requires depth maps for the dataset of photographs. To produce psuedo-ground truth depth maps we rely on a pretrained model from Boosting Monocular Depth Estimation Models to High-Resolution via Content-Adaptive Multi-Resolution Merging.

Citation

If you find this work useful please use the following citation:

 @article{chan2022drawings,
	      title={Learning to generate line drawings that convey geometry and semantics},
	      author={Chan, Caroline and Durand, Fredo and Isola, Phillip},
	      booktitle={CVPR},
	      year={2022}
	      }

Acknowledgements

Model code adapted from pix2pixHD and pytorch-CycleGAN-and-pix2pix

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.