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

Specific patch of image getting denoised #12

Open
adit-smoak opened this issue Nov 26, 2024 · 5 comments
Open

Specific patch of image getting denoised #12

adit-smoak opened this issue Nov 26, 2024 · 5 comments

Comments

@adit-smoak
Copy link

Hi, I am using the pretrained model to denoise my image of dimensions 400 (height) * 400 (width) * 224 (bands), but the output being saved is 220 (height) * 256 (width) * 224 (bands). Can you please help me resolve this issue? I have uploaded the image where input(left) and output on visualization tool on the right.
Also, can you verify that in the visualization tool, the image on the left is output and right is input??
qrnn_inp_out

@Vandermode
Copy link
Owner

Hi, could you share me with the code you used?
Otherwise it's not possible to debug this issue.

@adit-smoak
Copy link
Author

adit-smoak commented Nov 27, 2024

Thank you for the quick reply, in hsi_test.py, I found this snippet to be causing this issue:

mat_transform = Compose([
LoadMatKey(key='img'), # for testing
lambda x: x[:,:220,:256][None],
minmax_normalize,
])

The lamda function causes the image to be of reduced dimensions. So I tried this instead:

lambda x: x[:, :400, :400][None], #since my image has 400 rows and 400 columns

and the error is: RuntimeError: CUDA out of memory. Tried to allocate 2.14 GiB (GPU 0; 8.00 GiB total capacity; 10.83 GiB already allocated; 0 bytes free; 12.98 GiB reserved in total by PyTorch)

So I reduced the dimension: lambda x: x[:, :300, :300][None],
and this worked!!!

On the ICVL datasets, the model correctly denoises the image, with noisy input on left and corrected output on right but as you can see in the image attached above, the output appears to be more noisy than the input, what could be the reason for this?

I havent made any other changes in the codes from your repository apart from this. Still I have attached all the files.
hsi_test.zip

@Vandermode
Copy link
Owner

Thanks for the information.
Could you please provide me more information, specifically, the source of the hyperspectral image, the device info, and the preprocessing step you performed?

Note Real-world noise distribution in HSIs typically varies across imagers. Any deep learning based algorithm trained on a certain noise distribution would definitely fail to generalize to noise distribution that is different from what it was trained on. This is the major practical challenge when applying these DL-based model in practice.

For more information, please refer to the paper "Guided Hyperspectral Image Denoising with Realistic Data" published in IJCV 2022

@adit-smoak
Copy link
Author

Sorry for the late reply, I had my university exams so I couldnt focus on my project.
The source of hyperspectral image is this repository: https://github.com/huyanning/Hyperspectral-Anomaly-Detection under the name Sandiego.mat, the image is acquired from AVIRIS.
My laptop has AMD ryzen 7 with NVIDIA 4060 gpu.
The repository owner has directly used this image for anomaly detection, so I assumed it is already preprocessed, and I also used it as is.

A bit about my project: It involves a competition with the following problem statement: Target detection in hyperspectral images. The workflow for this problem includes performing atmospheric correction, followed by denoising the hyperspectral image, then pan-sharpening, anomaly detection, and finally detecting targets from the anomalies. For the denoising part, I am planning to use QRNN3D

I tried the same image with a complex model, and the results seem to be better for some bands. Even bands that initially appear completely gray show good results, while others are blurry. I assume this is why they included the 'pan-sharpening' step later in the process, to sharpen some of the blurry outputs. Some images are attached.

For more information, please refer to the paper "Guided Hyperspectral Image Denoising with Realistic Data" published in IJCV 2022

Could you please attach a PDF of this paper? My university isn't recognized by the publisher.
Thank you for your patience.

image
image

@Vandermode
Copy link
Owner

Hi, thanks for the detailed info. However, personally, I don't think denoising would be helpful for the anomaly detection. Probably you can just remove the completely degraded channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants