GithubHelp home page GithubHelp logo

rahulkishan-mobbed / deepmanifold Goto Github PK

View Code? Open in Web Editor NEW

This project forked from paulu/deepmanifold

0.0 2.0 0.0 16.51 MB

Deep Manifold Traversal

License: MIT License

Jupyter Notebook 4.84% Python 85.34% MATLAB 9.17% Shell 0.65%

deepmanifold's Introduction

Deep Manifold Traversal

Deep manifold traversal transforms an image so that it is more similar to a target submanifold and less similar to a source manifold. For example, if the source and target submanifolds are images of young and old faces, then a face image can be transformed to look older. Here is how it works:

First, deep convolutional features are extracted from each image by a GPU. Next, the manifold traversal equation is optimized by a CPU to find modified features. Finally, the image is optimized by a GPU to fit the modified features.

See http://arxiv.org/abs/1511.06421 for an explanation of the method.

Try it out

Run ./scripts/install/install_all.sh to install. This will install python dependencies, download caffe, compile caffe, and download the necessary weight file. It is assumed that caffe lives at ../caffe and it will not be downloaded if it already exists. You may also need: sudo apt-get install imagemagick.

The following command will generate a test image (in about 5 minutes):

./run_dmt.py --source images/young/*.jpg --target images/old/*.jpg --image images/Aaron_Eckhart_0001.jpg

How to write your own scripts

The main method is dmt.run() which takes a list of image pathnames where the first N entries define the source submanifold, the next M entries define the target submanifold, the next L entries (optional) are additional images which increase the number of basis vectors and the remaining entries are the images to be transformed. See the function documentation for details.

ipath = [source1, ..., sourceN, target1, ..., targetM, data1, ..., dataL, image1, ...]
weights = [lambda1, lambda2, ...]
XF,F2,root_dir,result = dmt.run(ipath,N,M,L,'vgg',[125,125],device_id,weights,rbf_var,prefix,3000,False,False)

The run_dmt.py script is a minimal wrapper which demonstrates how to call dmt.run(). Look inside run_dmt.py for hints on how to set lambda weights and rbf kernel variances.

How to process large images

We found the limit to be main memory. Amazon EC2 offers CPU machines with 244 GB of memory which is enough to process 900 x 600 images. You can optimize the manifold traversal equation there, then transfer the results to a GPU machine for the reconstruction optimization. See the run_daynight.py script for an example of how we do this.

Updates

The old gen_deepart.py methods (2015 November) are now deprecated. The new dmt.py (2016 March) is faster and uses less memory.

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.