lanha / DSen2

Super-Resolution of Sentinel-2 Images: Learning a Globally Applicable Deep Neural Network
GNU General Public License v3.0
235 stars 70 forks source link

Test results #11

Closed Lithsun closed 5 years ago

Lithsun commented 5 years ago

Hi Lanha,

I test your trained model with RMSE,SRE,SAM, UIQ metrics. But the UIQ and SAM values are not same as the results in your paper. I use the UIQ and SAM functions that are provied by sewar (one python package).

lanha commented 5 years ago

Are the RMSE and SRE metrics the same?

Lithsun commented 5 years ago

RMSE and SRE are same . SAM and UIQ are higher.

Those metrics functions are provided by one python package, which is named sewar. (You can check the document here https://sewar.readthedocs.io/en/latest/)

Besides, two test images have black area where the pixel values are 0. I'd like to know how you deal with it when calculating SAM and UIQ.

On 09/16/2019 17:29, Charis Lanaras wrote:

Are the RMSE and SRE metrics the same?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

Lithsun commented 5 years ago

Are the RMSE and SRE metrics the same?

RMSE and SRE are same . SAM and UIQ are higher.

Those metrics functions are provided by one python package, which is named sewar. (You can check the document here https://sewar.readthedocs.io/en/latest/)

Besides, two test images have black area where the pixel values are 0. I'd like to know how you deal with it when calculating SAM and UIQ.

lanha commented 5 years ago

Given the fact that you get the published results for RMSE and RSE that suggests that there is some problem in computing SAM and UIQ and not with the result of DSen2.

I am not computing the SAM and UIQ for pixels with values of 0. That means these pixels are not used to compute the average over the whole image.

Lithsun commented 5 years ago

Are those SAM and UIQ functions provide by sewar same as yours? RMSE and SRE are calculated per band and then averaged. Is this the same way to calculate SAM and UIQ per band?

lanha commented 5 years ago

It appears to me that sewar is reporting the result of SAM in radians, whereas in the paper we report the SAM in degrees. For SAM you cannot compute the value per band, it has to be computed per pixel and then averaged over the whole image for each pixel.

def SAM(y_true, y_pred):
    num = np.sum(np.multiply(y_pred, y_true), axis=2)
    denom1 = np.sqrt(np.sum(np.square(y_true), axis=2))
    denom2 = np.sqrt(np.sum(np.square(y_pred), axis=2))
    div = np.divide(num, np.multiply(denom1, denom2))
    tmp = np.clip(div, -1, 1)
    sam = np.arccos(tmp)
    ind = ~np.isnan(div)
    sam = np.mean(sam[ind])*180/np.pi
    print('SAM:    {:.5f}'.format(sam))
    return sam

The UIQ measure is harder to share the code. The value of UIQ is actually computed per band. You can have a look here: https://bitbucket.org/kuraiev/pymetrikz/src/default/

Lithsun commented 5 years ago

Thanks for your help! After recalculating, SAM and UIQ values are correct.