SuLvXiangXin / zipnerf-pytorch

Unofficial implementation of ZipNeRF
Apache License 2.0
802 stars 87 forks source link

Transform to grayscale when calculating SSIM #96

Open Ganlin-Yang opened 9 months ago

Ganlin-Yang commented 9 months ago

Hi: Thanks for your great works. I have a minor question: in your implementation of SSIM metric in https://github.com/SuLvXiangXin/zipnerf-pytorch/blob/main/internal/image.py#L111, you transform image from RGB to single-channel before calculating SSIM. However, according to the original official implementation MultiNeRF: https://github.com/google-research/multinerf/blob/main/internal/image.py#L127, it seems not doing such an operation. I've tried to replace line ssim = float(structural_similarity(rgb_pred_gray, rgb_gt_gray, data_range=255)) with ssim = float(structural_similarity(rgb_pred, rgb_gt, data_range=255, channel_axis=-1)), and got a slightly lower number in SSIM. For example, drop from 0.6088 to 0.6058. Any suggestions? Thanks