luanfujun / deep-photo-styletransfer

Code and data for paper "Deep Photo Style Transfer": https://arxiv.org/abs/1703.07511
9.99k stars 1.41k forks source link

Is removing the Matlab dependency possible? #4

Closed ProGamerGov closed 7 years ago

ProGamerGov commented 7 years ago

I'd love to experiment with this project, but I'd rather not have to buy Matlab first as it is not free like Torch, Tensorflow, Theano, Caffe, etc...

So is removing the Matlab dependency possible? And if so, how difficult would it be?

luanfujun commented 7 years ago

Ah... Yes it is possible. The only Matlab part in this project is to compute the matting Laplacian matrix, Eq. 12 in this paper with their Matlab code. Similar issue to #1.

ProGamerGov commented 7 years ago

@luanfujun Is using Octave: https://www.gnu.org/software/octave/ instead of Matlab possible without modifying the code? Octave appears to support all the required Matlab stuff, and it's free and open source software.

Edit: Testing Octave:

ubuntu@ip-Address:~/deep-photo-styletransfer$ octave

octave:1> run('gen_laplacian/gen_laplacian.m')
warning: addpath: matting\: No such file or directory
warning: addpath: gaimc\: No such file or directory
Working on image index = 1
warning: your version of GraphicsMagick limits images to 16 bits per pixel
'im2double' undefined near line 10 column 13
error: called from 'gen_laplacian.m' in file /home/ubuntu/deep-photo-styletransfer/gen_laplacian/gen_laplacian.m near line 10, column 11
octave:1>
luke14free commented 7 years ago

first run $ sudo apt-get install liboctave-dev then from octave after you downloaded image-2.6.1.tar.gz from https://octave.sourceforge.io/image/ run pkg install image-2.6.1.tar.gz, finally run pkg load imageand then execute the script. Note that then I had an issue with some directories not being correctly imported (and there was an undefined getLaplacian1()), to fix it simply change the first two lines of the matlab file to:

addpath matting/
addpath gaimc/

(basically reversing the slash)

martinbenson commented 7 years ago

@luke14free I got Octave to work by doing the same things that you described, but the .Mat files it creates don't work in the deepmatting script for me. Do they work for you?

mrubashkin-svds commented 7 years ago

For Clarity on @luke14free comment: On the command line:

cd [parent directory of deep-photo-styletransfer]
sudo apt-get install liboctave-dev
wget https://downloads.sourceforge.net/project/octave/Octave%20Forge%20Packages/Individual%20Package%20Releases/image-2.6.1.tar.gz?r=&ts=1491430627&use_mirror=superb-sea2
mv image-2.6.1.tar.gz?r= image-2.6.1.tar.gz

Then run inside of octave, by launching octave on the command line: octave

pkg install image-2.6.1.tar.gz
pkg load image
run('deep-photo-styletransfer/gen_laplacian/gen_laplacian.m')
NewETown commented 7 years ago

Is there a solution for this running on Mac instead of Ubuntu? I'm running into the same 'im2double' undefined problem trying to run run('gen_laplacian/gen_laplacian.m') in Octave :(

martinbenson commented 7 years ago

I removed the MATLAB/Octave dependency in my fork: https://github.com/martinbenson/deep-photo-styletransfer

NewETown commented 7 years ago

@martinbenson Thanks! This is perfect