Open themightyoarfish opened 7 years ago
I had the same problem. I rewrote the MATLAB bit in Python and made a PR, but you can also pick up the fork here: https://github.com/martinbenson/deep-photo-styletransfer
I'm seeing the same issue when using Octave
Same issue, with Octave. GNU Octave, version 4.0.2 Ubuntu 16.04
Here's one workaround to be able to read your Octave produced laplacian data in matio, you can use Octave to load and resave it in a matlab compatible format. First, load your existing .mat file in Ocatave using:
data = load('gen_laplacian/Input_Laplacian_3x3_1e-7_CSR1.mat')
Don't forget to back up the .mat file since they take forever to generate. Now save in a matlab (and matio) compatible format using:
save "-mat7-binary" gen_laplacian/Input_Laplacian_3x3_1e-7_CSR1.mat data
More info on loading/saving here. Now you can see your data:
The row count is correct for my test image at the time of the screenshot (different from the final image however, this process took a few troubleshooting trials). Note mat7data.data.CSR
, this is what we want to pass to cuda()
in this line of deepmatting_seg.lua. So that line changes from:
local CSR = matio.load(CSR_fn).CSR:cuda()
to
local CSR = matio.load(CSR_fn).data.CSR:cuda()
Here is my resulting test image. I chose perhaps the most unremarkable example image from this repo's collection, but you can see it looks about how we'd expect when compared to the promo photos in the main README:
Thanks @jogleasonjr ! It worked perflectly for me :)
I did compile all the gen_laplacian with Octave then tried out @jogleasonjr .mat approach. However it didn't seem to work for me, I keep getting this error, any thoughts?
loading matting laplacian... gen_laplacian/Input_Laplacian_3x3_1e-7_CSR1.mat
Segmentation fault (core dumped)
Thanks
@jogleasonjr Your approach is also useful for me. Thank you very much. But I am a little confused about how do you know that "The row count is correct for my test images. "?
For the test image in1.png, the size of my data is 7613426x3, not 12208036x3 shown in your figure. So do you change the script file, which is used to generate the "Input_Laplacian_3x3_1e-7_CSR1.mat"?
@John-HW-Cao Apologies for the confusion. The screenshots I took were from disjointed trial runs using different images, where at the end I tested the provided in1.png end-to-end. So when I said "The row count is correct for my test images", I should have said "The row count is correct for my test image at the time of the screenshot (different from the final image however, this process took a few troubleshooting trials). "
I've updated my comment. Thanks for pointing this out!
@jogleasonjr Thank you for your quick response!
@John-HW-Cao How to do that?Can you help me?Where is the file 'Input_Laplacian_3x3_1e-7_CSR1.mat'
It works well by jogleasonjr 's method. But when we want to run a dataset, it will cost much manual operation. I change the code in
gen_laplacian.m from save( ['Input_Laplacian_3x3_1e-7_CSR' int2str(i) '.mat'], 'CSR'); to
save("-mat7-binary", ['Input_Laplacian_3x3_1e-7_CSR' int2str(i) '.mat'], 'CSR');
In this way, we don't need to change the code of deepmatting_seg.lua as mentioned before.
I've been met with the same issue and have also tried the approach @jogleasonjr has outlined but am also met with the same segmentation fault issue as before when loading the generated laplacian.mat file inside of deepmatting_seg.lua
Are there any more approaches I could take to solve this issue? I am using Octave 4.2.1 to generate the laplacian file.
When I try running step 4 (after having generated the intermediate for
in1
andtra1
successfully), I get thisThe CSR file is generated with octave 4.0. There's an issue here, that hints at Matlab version compatibility issues. I don't know if this prevents use of Octave.