remicres / sr4rs

Super resolution for remote sensing
MIT License
161 stars 19 forks source link

Weird results when producing a HR image #59

Open Topping1 opened 1 year ago

Topping1 commented 1 year ago

I am using sr4rs version 1.3 and otbtf version 3.3.3-gpu on ubuntu 22.04 (GPU is Quadro P1000). I have downloaded 4 bands of an image (B4,B3,B2,B8) from Sentinel-2 using the site EO Browser. I have installed sr4rs using the instructions provided and concatenated the images using otbcli_ConcatenateImages. When I run the program, I get results like the following image:

image

do you know what might be causing this issue? I can provide more information if needed.

remicres commented 1 year ago

Hi @Topping1 ,

This reminds me a similar issue where an user has reported such strange result, but I didn't have enough info at the time.

In order to solve this, could you try to:

thanks

Topping1 commented 1 year ago

Thanks for your quick response.

-The image at pixel resolution is below: image

-the result of gdalinfo -stats is below:

Driver: GTiff/GeoTIFF
Files: merge-4326.tif
merge-4326.tif.aux.xml
Size is 459, 233
Coordinate System is:
GEOGCRS["WGS 84",
DATUM["World Geodetic System 1984",
ELLIPSOID["WGS 84",6378137,298.257223563,
LENGTHUNIT["metre",1]]],
PRIMEM["Greenwich",0,
ANGLEUNIT["degree",0.0174532925199433]],
CS[ellipsoidal,2],
AXIS["geodetic latitude (Lat)",north,
ORDER[1],
ANGLEUNIT["degree",0.0174532925199433]],
AXIS["geodetic longitude (Lon)",east,
ORDER[2],
ANGLEUNIT["degree",0.0174532925199433]],
ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-78.656294345999996,-6.753707714000000)
Pixel Size = (0.000089757583878,-0.000089531502146)
Metadata:
AREA_OR_POINT=Area
Image Structure Metadata:
INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left ( -78.6562943, -6.7537077) ( 78d39'22.66"W, 6d45'13.35"S)
Lower Left ( -78.6562943, -6.7745686) ( 78d39'22.66"W, 6d46'28.45"S)
Upper Right ( -78.6150956, -6.7537077) ( 78d36'54.34"W, 6d45'13.35"S)
Lower Right ( -78.6150956, -6.7745686) ( 78d36'54.34"W, 6d46'28.45"S)
Center ( -78.6356950, -6.7641381) ( 78d38' 8.50"W, 6d45'50.90"S)
Band 1 Block=459x1 Type=Float32, ColorInterp=Gray
Min=0.015 Max=0.964 
Minimum=0.015, Maximum=0.964, Mean=0.119, StdDev=0.079
Metadata:
STATISTICS_MAXIMUM=0.96410000324249
STATISTICS_MEAN=0.118685167457
STATISTICS_MINIMUM=0.015100000426173
STATISTICS_STDDEV=0.078870281782
STATISTICS_VALID_PERCENT=100
Band 2 Block=459x1 Type=Float32, ColorInterp=Undefined
Min=0.009 Max=1.002 
Minimum=0.009, Maximum=1.002, Mean=0.120, StdDev=0.073
Metadata:
STATISTICS_MAXIMUM=1.0017999410629
STATISTICS_MEAN=0.12008681779008
STATISTICS_MINIMUM=0.0091000003740191
STATISTICS_STDDEV=0.072611022876824
STATISTICS_VALID_PERCENT=100
Band 3 Block=459x1 Type=Float32, ColorInterp=Undefined
Min=0.000 Max=0.974 
Minimum=0.000, Maximum=0.974, Mean=0.093, StdDev=0.072
Metadata:
STATISTICS_MAXIMUM=0.97399997711182
STATISTICS_MEAN=0.0925235285364
STATISTICS_MINIMUM=0.00039999998989515
STATISTICS_STDDEV=0.071719903379566
STATISTICS_VALID_PERCENT=100
Band 4 Block=459x1 Type=Float32, ColorInterp=Undefined
Minimum=0.004, Maximum=0.982, Mean=0.236, StdDev=0.095
Metadata:
STATISTICS_MAXIMUM=0.9815000295639
STATISTICS_MEAN=0.23577339054692
STATISTICS_MINIMUM=0.0041000000201166
STATISTICS_STDDEV=0.0947568401415
STATISTICS_VALID_PERCENT=100

-the area that I want to process is quite small, so I am including the entire image (and the bands as downloaded from EO browser) in the Zip file below:

image.zip

thanks for you help!

remicres commented 1 year ago

Thanks, the problem comes from the input image, there is no doubt. The input image pixel values ranges and [0, 1] which is very different from the Sentinel-2 level 2A (integer, 16 bits). I don't know what processing the provider made, but it clearly has changed the image values. The pre-trained network is suited for the original, level 2A, 16 bits images. Maybe they just have applied another radiometric correction, and keep the resulting value as float. In this case you could try to multiply the input image with a factor (1000? or better, the correct factor). What you can do is download the same S2 image from the microsoft planetary computer (e.g. using the QGIS STAC plugin), and compare the values.

Topping1 commented 1 year ago

Merci beaucoup! I will try your suggestions and report back the results.

Topping1 commented 1 year ago

It worked, it seems that I downloaded the files from EO Browser using a 32 bit format (EO Browser offers 16 bit and 32 bit formats). Once I downloaded again as 16 bit, everything worked correctly. Thanks for your help.