Skip to content

Instantly share code, notes, and snippets.

View daa233's full-sized avatar
🎯
Focusing

Du Ang daa233

🎯
Focusing
  • πŸŒ‘
  • Beijing, China
View GitHub Profile
@charliememory
charliememory / tf_ms_ssim.py
Created August 28, 2018 16:24
tensorflow implement of Multiscale SSIM
#################### MS_SSIM Loss #####################
## ref code: https://stackoverflow.com/questions/39051451/ssim-ms-ssim-for-tensorflow
def _tf_fspecial_gauss(size, sigma):
"""Function to mimic the 'fspecial' gaussian MATLAB function
"""
x_data, y_data = np.mgrid[-size//2 + 1:size//2 + 1, -size//2 + 1:size//2 + 1]
x_data = np.expand_dims(x_data, axis=-1)
x_data = np.expand_dims(x_data, axis=-1)