tensorflow-wavelets icon indicating copy to clipboard operation
tensorflow-wavelets copied to clipboard

How to get three channel output from IDWT?

Open SusmitaSenGhosh opened this issue 3 years ago • 4 comments

I have a three-channel image (RGB). While performing IDWT using the coefficients obtained from DWT, I got one channel output. Can you please let me know how to obtain three-channel output from IDWT?

SusmitaSenGhosh avatar May 18 '22 07:05 SusmitaSenGhosh

Thenk you for openning this issue.

I see the problem, for now I will recommand you to do the dwt for each channel separatly. I will work on a fix for this issue hopefully I will fix it soon

Timorleiderman avatar May 18 '22 21:05 Timorleiderman

Thanks. That is what I am doing now. It would be of help if it can be generalized for n-channel inputs. Thanks again.

SusmitaSenGhosh avatar May 19 '22 05:05 SusmitaSenGhosh

Any updates on this? I would like to be able to use this for a project I am working on. I am able to get the right numbers for the output, but the shape seems to be wrong.

Here's the code i am using to test it out

if __name__ == '__main__':
    transform = DWT(name='db4', concat=0)
    inverse = IDWT(name='db4', concat=0)
    ones = tf.ones((3, 160, 64, 1))

    output = transform(ones)
    inverted = inverse(output)
    print(ones.shape, output.shape, inverted.shape)
    # expect to be (3, 160, 64, 1) (3, 80, 32, 4) (3, 160, 64, 1)
    # found to be  (3, 160, 64, 1) (3, 80, 32, 4) (3, 64, 160, 1)

ChilloutCharles avatar Dec 18 '24 03:12 ChilloutCharles

Thanks, I added a fix for the shape issue

and added a test for it :)

https://github.com/Timorleiderman/tensorflow-wavelets/blob/35d9f81286f6808483d7b2edf6f6178c73b1b826/src/test.py#L107

Timorleiderman avatar Dec 20 '24 11:12 Timorleiderman