fbcotter / pytorch_wavelets

Pytorch implementation of 2D Discrete Wavelet (DWT) and Dual Tree Complex Wavelet Transforms (DTCWT) and a DTCWT based ScatterNet
Other
943 stars 146 forks source link

How to implement DTCWT to 1-D signals? #35

Open QuasiLegendre opened 2 years ago

QuasiLegendre commented 2 years ago

Thanks for such a convenient framework! Is there anyway or method to implement DTCWT to 1-D signals? Also, does DTCWT has advantage over DWT in signal processing?

fbcotter commented 2 years ago

Hi @QuasiLegendre, it's not currently available in this repo but it wouldn't be too hard to add if it would be of use. As for the advantages of the DTCWT over the DWT - yes there are indeed! I'll refer you to the journal paper here: https://eeweb.engineering.nyu.edu/iselesni/pubs/CWT_Tutorial.pdf, in particular note the 4 problems mentioned in the introduction.

However, the DTCWT does add some complexity too, so it's hard to say if it's worth the extra effort. What's the use case you're thinking of?

QuasiLegendre commented 2 years ago

Thanks for your advice! My use case is to find a optimized wavelet filtering/smoothing method for my particular 1-D real signal for signal anomaly detection in the next step(LSTM/GRU or 1-D CNN).
image The signal is shown above, the red-labeled part is abnormal signal, while the blue part is referred as normal signal. The x axis means time, and y axis is voltage.

fbcotter commented 2 years ago

If you want to get good localisation of the signal then yes perhaps the DTCWT will be a good one to use. I can make a 1D version of it for you but it may take a couple of days. In the meantime, I'd suggest first trying with the DWT to see how well it works though.

QuasiLegendre commented 2 years ago

I will take your advice and try DWT in several days. Thank you the recommendation and help!

lostmsu commented 2 years ago

@fbcotter any plans to release 1.3 with 1D DWT?

fbcotter commented 2 years ago

Do you mean a 1D DTCWT? There already should be a 1D DWT in there. I see I haven't made docs for it though, so maybe you just didn't see it.

from pytorch_wavelets import DWT1DForward, DWT1DInverse
lostmsu commented 2 years ago

@lostmsu no, I mean PyPi only has 1.2, so to get 1.3 one currently needs to install from source.

fbcotter commented 2 years ago

Oh I see. Sure, I can do that

naba89 commented 1 year ago

Hey, did you ever get around to implementing the 1D DTCWT?

Tokenmw commented 1 year ago

Hello, I would like to ask if you have implemented DTCWT to 1-D signals? Thank you so much.