mirror of
https://github.com/graphdeco-inria/gaussian-splatting
synced 2025-02-22 20:21:14 +00:00
Using the pip library torchmetrics makes the evaluation process more robust
You can install torchmetrics with: # Python Package Index (PyPI) pip install torchmetrics # Conda conda install -c conda-forge torchmetrics
This commit is contained in:
parent
2eee0e26d2
commit
bd9297a0d8
@ -15,12 +15,14 @@ from PIL import Image
|
|||||||
import torch
|
import torch
|
||||||
import torchvision.transforms.functional as tf
|
import torchvision.transforms.functional as tf
|
||||||
from utils.loss_utils import ssim
|
from utils.loss_utils import ssim
|
||||||
from lpipsPyTorch import lpips
|
from torchmetrics.image.lpip import LearnedPerceptualImagePatchSimilarity
|
||||||
import json
|
import json
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
from utils.image_utils import psnr
|
from utils.image_utils import psnr
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
|
|
||||||
|
lpips = LearnedPerceptualImagePatchSimilarity(net_type='vgg').cuda()
|
||||||
|
|
||||||
def readImages(renders_dir, gt_dir):
|
def readImages(renders_dir, gt_dir):
|
||||||
renders = []
|
renders = []
|
||||||
gts = []
|
gts = []
|
||||||
@ -71,7 +73,7 @@ def evaluate(model_paths):
|
|||||||
for idx in tqdm(range(len(renders)), desc="Metric evaluation progress"):
|
for idx in tqdm(range(len(renders)), desc="Metric evaluation progress"):
|
||||||
ssims.append(ssim(renders[idx], gts[idx]))
|
ssims.append(ssim(renders[idx], gts[idx]))
|
||||||
psnrs.append(psnr(renders[idx], gts[idx]))
|
psnrs.append(psnr(renders[idx], gts[idx]))
|
||||||
lpipss.append(lpips(renders[idx], gts[idx], net_type='vgg'))
|
lpipss.append(lpips(renders[idx], gts[idx]))
|
||||||
|
|
||||||
print(" SSIM : {:>12.7f}".format(torch.tensor(ssims).mean(), ".5"))
|
print(" SSIM : {:>12.7f}".format(torch.tensor(ssims).mean(), ".5"))
|
||||||
print(" PSNR : {:>12.7f}".format(torch.tensor(psnrs).mean(), ".5"))
|
print(" PSNR : {:>12.7f}".format(torch.tensor(psnrs).mean(), ".5"))
|
||||||
|
Loading…
Reference in New Issue
Block a user