leehomyc / Faster-High-Res-Neural-Inpainting

High-Resolution Image Inpainting using Multi-Scale Neural Patch Synthesis
http://www.harryyang.org/inpainting
MIT License
1.3k stars 213 forks source link

get exception when run th blend.lua #22

Closed brickjava closed 6 years ago

brickjava commented 7 years ago

/root/torch/install/bin/luajit: inconsistent tensor size, expected r_ [4 x 512 x 512], t [4 x 512 x 512] and src [3 x 512 x 512] to have the same number of elements, but got 1048576, 1048576 and 786432 elements respectively at /root/torch/pkg/torch/lib/TH/generic/THTensorMath.c:902 stack traceback: [C]: at 0x7fa61a805110 [C]: in function 'cmul' blend.lua:8: in main chunk [C]: in function 'dofile' /root/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk [C]: at 0x004064f0

brickjava commented 7 years ago

@leehomyc please give me some idea, thank u a lot

brickjava commented 7 years ago

my png is 512*512

leehomyc commented 7 years ago

It says your image has 4 channels? The mask only has 3 channels: mask=mask[{{1,3},{},{}}] (line 7). Could you verify whether your image is 4 channels or 3 channels?

brickjava commented 7 years ago

@leehomyc I change the src img, the img is a png with 3 channels. Q1. the pic must be 4 channels? Q2. the hole of the pic must be 128*128, can I change the shape of it?

leehomyc commented 7 years ago

What I was saying is that the picture should be 3 channels instead of 4 channels. But it seems the error is because your input has 4 channels. Could you verify that?

Yes you can change the shape in texture optimization but not in content prediction. In texture optimization you can provide any content/style image as input, hence it doesn't matter what your hole is. You just need to provide proper content and style image.