remicres / sr4rs

Super resolution for remote sensing

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About patches_center_locations.shp

Eliaukyxw opened this issue · comments

Hi,@remicres
When pre-training, I had two problems: 1. Can the resolution of HR image and LR image vary by a factor of 5 by changing the patchsize? 2. Is the patches_center_locations.shp file only contain HR image's patches centers? Or also need LR image's patches centers?

Hi @Eliaukyxw ,

  1. The images resolutions must vary by a factor of 2^n. You can resample the LR or the HR image depending on the output resolution you want to reach.

  2. The patches_center_locations.shp contains (LR, HR) patches centers. For each LR patch you must have a target HR patch.

Got it! Thank you for your prompt reply!I will try the resampling method.

Hi, @remicres
Looks like I'm having some questions again:
Firstly, when I preparing my patches images, there is an ERROR: Parameter -source2.il does not exist in the application.
1
And then, I try the code:
OTB_TF_NBSOURCES=2 otbcli_PatchesExtraction \ -source1.il AVHRR2000-03--2005-03_subset.tif \ -source1.patchsizex 8 \ -source1.patchsizey 8 \ -source1.out lr_patches.tif int16 \ -vec patches_center_locations.shp \ -field "fid"
but there is also an error:
2
As shown below,When I generated the patches_center_locations.shp file, I have already created the "fid" filed. So I don't know how to solve these problems.
3
Really need your help. Thank you very much!

Hi @Eliaukyxw

  • The environment variable to change the number of sources is misspelled. It is OTB_TF_NSOURCES (not ...NBSOURCES)
  • Your fid field has no value. It should be integer type.

Thank you for your prompt reply!I finally succeeded in creating the patches images!And I'm going to continue with the experiment.😀

Hi, @remicres
I'm sorry to bother you again. Is there something wrong with my code?
4
5
I downloaded the lr_patches.tif and hr_patches.tif to see if they match each other and found that they didn't match:
6
Will it affect the training of the model?And how can I solve this problem?

Don't worry at this point the patches have no geographical information. It won't affect the training.
When you open them in QGIS for instance, they are displayed using some pixel spacing information taken from metadata, but the origin in still [0, 0] that is why they might look shifted a bit (center=pixel center instead of pixel top-left coordinate)

Oh I see! Great Remicres! Thanks again, we couldn’t have pulled this off without you.

Hi, @remicres
Thank you for a series of work, with your help I successfully completed the experiment.
Through experiments, I found that OTBTF docker can be used to make LR/HR patches very conveniently. I have a guess: Under this framework, can we use other super resolution networks besides GAN network for training? If so, how can I modify the code file to make it work?

Hi @Eliaukyxw ,

Yes of course you can get rid of GAN losses and remove the discriminator.
You can modify the generator in networks.py and develop your own model. Just keep in mind that is must preserve the outputs to inputs resolutions factors (defined in constants.py) at the different scales.

OK, really appreciate your advice! I will have a try!

Hi, @remicres
I'm terribly sorry I have so many questions.😂
In constants.py , If the LR images to HR images is 8 times larger, factors can be changed to [1,2,4,8], right?

Yes.
You also have to adapt the networks so that the tensors dimensions are correct.

Greetings! @remicres
Please forgive my ignorance, because I am new to this field.
I want to know if my tif image has only one or two channels, how do I modify the network to make it work?
Like the following pictures, an error occurred when input Channel was 1:
10
11
Looking forward to you early reply!