Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complex max pooling #17

Closed
NEGU93 opened this issue Apr 16, 2021 · 3 comments
Closed

Complex max pooling #17

NEGU93 opened this issue Apr 16, 2021 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@NEGU93
Copy link

NEGU93 commented Apr 16, 2021

Is there an implementaion of a complex max pooling?

@ivannz
Copy link
Owner

ivannz commented Apr 17, 2021

Complex max pooling, i assume, would be a split activation, meaning that it would be applied to the real and imag components independently. In this case, you could do the following:

import torch

from torch.nn import MaxPool2d

from cplxmodule import Cplx
from cplxmodule.nn import CplxToCplx

input = Cplx(real=torch.randn(1, 4, 8, 8), imag=torch.randn(1, 4, 8, 8))

# create a split-layer
CplxMaxPool2d = CplxToCplx[MaxPool2d]

layer = CplxMaxPool2d(2, 2)

layer(input)

You can see a couple of other examples in the README of cplxmodule.nn

@NEGU93
Copy link
Author

NEGU93 commented Apr 19, 2021

Actually, that would destroy the phase information as the max of real and imaginary can be from different indices. I was thinking more about the way listed in Cao et al. "Pixel-Wise PolSAR Image Classification via a Novel Complex-Valued Deep Fully Convolutional Network" or Zhang et al. "Complex-Valued Convolutional Neural Network and Its Application in Polarimetric SAR Image Classification".

In both cases, they apply the max-pooling to the absolute value. PS: The output, however, must still be complex of course. The comparison of a>b is done with the absolute value.

@ivannz ivannz self-assigned this Jul 28, 2021
@ivannz ivannz added the enhancement New feature or request label Jul 28, 2021
ivannz added a commit that referenced this issue Jul 28, 2021
@ivannz
Copy link
Owner

ivannz commented Jul 28, 2021

I apologise for ignoring your issue for so long @NEGU93 . I have implemented the core functions and the layers for the max-pooling you requested. Below is the abstract description of the operation

image

The split-layer max-pooling above can also be used.

i hope the layers are still relevant to your work or research.

@NEGU93 NEGU93 closed this as completed Jul 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants