XY-boy / TTST

[IEEE TIP 2024] TTST: A Top-k Token Selective Transformer for Remote Sensing Image Super-Resolution
92 stars 5 forks source link

Error when running with different sizes of image #3

Open pvtoan opened 8 months ago

pvtoan commented 8 months ago

Hi,

Thank you so much for your work!

I have just tested your code with an image of 510x339 pixel but I got an error

x = x.view(b, h // window_size, window_size, w // window_size, window_size, c) RuntimeError: shape '[1, 42, 8, 63, 8, 1]' is invalid for input of size 172890

Therefore, I cropped that image to 128x128 pixel and it works as normal. The reason to choose the size of 128x128 comes from your example image "airport_285.png" in your source code.

Could you please check and fix this problem?

Thank you for your help!

XY-boy commented 8 months ago

Hi,

Thank you so much for your work!

I have just tested your code with an image of 510x339 pixel but I got an error

x = x.view(b, h // window_size, window_size, w // window_size, window_size, c) RuntimeError: shape '[1, 42, 8, 63, 8, 1]' is invalid for input of size 172890

Therefore, I cropped that image to 128x128 pixel and it works as normal. The reason to choose the size of 128x128 comes from your example image "airport_285.png" in your source code.

Could you please check and fix this problem?

Thank you for your help!

Hi, many thanks for your interest. This error is due to the window-based self-attention, where we need to split the image to several windows, such as window_size = 8 in Line 906

TTST/model_archs/TTST_arc.py

In other words, if the image size is not divisible by 8, it will report this error. I suggest resampling or cropping your images to avoid this. Or you can retrain TTST with appropriate settings.

pvtoan commented 8 months ago

Thank you for your explanations!

I got it.

Also, the current pre-trained model you open is "scale-up-x4" version. So, can I extract the HR image with non-scale (x1)? For example, like extracting output before reconstruction layer.

If yes, could you please let me know clearly how to get non-scaled HR image?

XY-boy commented 8 months ago

Thank you for your explanations!

I got it.

Also, the current pre-trained model you open is "scale-up-x4" version. So, can I extract the HR image with non-scale (x1)? For example, like extracting output before reconstruction layer.

If yes, could you please let me know clearly how to get non-scaled HR image?

I don't quite understand the meaning of non-scale, does it mean that the feature size is the same as the input low resolution image?

pvtoan commented 8 months ago

Hi,

Non-scale means the input and output image should have the same size.

For example, when I run the prediction code, given the LR input image with size of 128x128, the pre-trained model outputs the HR image with the size of 512x512 (scaled up to x4).

However, in my application, I only want to make LR image more clear without changing its size. It means, the LR and HR image must have the same size at 128x128.

In this case, can I get HR output image with the same size as LR input image from your pre-trained model?

XY-boy commented 8 months ago

Hi,

Non-scale means the input and output image should have the same size.

For example, when I run the prediction code, given the LR input image with size of 128x128, the pre-trained model outputs the HR image with the size of 512x512 (scaled up to x4).

However, in my application, I only want to make LR image more clear without changing its size. It means, the LR and HR image must have the same size at 128x128.

In this case, can I get HR output image with the same size as LR input image from your pre-trained model?

In this case, our pre-trained model cannot handle it. The SR problem involves an increase in image size.

pvtoan commented 8 months ago

I got it.

Thank you!

732259408 commented 3 months ago

hi, sorry to disturb you. l also want to make LR image more clear without changing its size. do you have some ideas? can we discuss together? @pvtoan

pvtoan commented 3 months ago

Hi,

Sorry, but we closed this project without going further.

732259408 commented 3 months ago

ok, thank you for telling me @pvtoan