Coder Social home page Coder Social logo

rudyryk / deepparametricshapes Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dmsm/deepparametricshapes

0.0 0.0 0.0 1.08 MB

Code for Deep Parametric Shape Predictions using Distance Fields, in CVPR 2020.

Home Page: https://people.csail.mit.edu/smirnov/deep-parametric-shapes/

License: MIT License

Python 100.00%

deepparametricshapes's Introduction

DeepParametricShapes | Webpage | Paper | Video

Deep Parametric Shapes

Deep Parametric Shape Predictions using Distance Fields
Dmitriy Smirnov, Matthew Fisher, Vladimir G. Kim, Richard Zhang, Justin Solomon
Conference on Computer Vision and Pattern Recognition (CVPR) 2020

Set-up

To install the code, run:

sudo apt install libcairo2-dev pkg-config python3-dev
conda create -n dps python=3.6 -y
conda activate dps
conda install pytorch torchvision cudatoolkit=10.2 -c pytorch -y
pip install -r requirements.txt

Also, be sure to execute export PYTHONPATH=:$PYTHONPATH prior to running any of the scripts.

2D: Font Vectorization

Demo

First, download a pretrained font vectorization model:

mkdir -p models/dps_2d
wget -O models/dps_2d/ckpt.pth https://www.dropbox.com/s/46tp19h6npqhuuh/dps_2d.pth\?dl\=0

Then, run the following to generate a PDF file with the vectorization for a given input glyph PNG image:

python scripts/run_2d.py demo/P1.png P out.pdf

Make sure to specify the letter of the input glyph (in this case P). The demo directory contains PNGs of the GAN-generated glyphs used for Figure 13 of the paper.

Training

To prepare the training dataset, first download and extract the font TTF files:

wget -O fonts.tar.gz https://www.dropbox.com/s/7oreepk5gm0efj4/fonts.tar.gz?dl=0
tar -xvf fonts.tar.gz

Then, process the TTFs to generate the input images and target distance fields:

python scripts/generate_fonts.py

To train a model from scratch, run:

python scripts/train_2d.py --output models/model_name --data data/fonts

3D: Shape Abstraction

Pretrained Models

Run the following to download pretrained models for airplane and chair shape abstraction:

mkdir -p models/airplanes
wget -O models/airplanes/ckpt.pth https://www.dropbox.com/s/k91u1zjdywgqdga/dps_3d_airplanes.pth?dl=0
mkdir -p models/chairs
wget -O models/chairs/ckpt.pth https://www.dropbox.com/s/i4l0rrx6rbit0fa/dps_3d_chairs.pth?dl=0

BibTeX

@inproceedings{smirnov2020dps,
  title={Deep Parametric Shape Predictions using Distance Fields},
  author={Smirnov, Dmitriy and Fisher, Matthew and Kim, Vladimir G. and Zhang, Richard and Solomon, Justin},
  year={2020},
  booktitle={Conference on Computer Vision and Pattern Recognition (CVPR)}
}

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.