FID与LPIPS等图像质量与多样性指标

前言

近年来,由于预训练模型的兴起,图像生成领域的客观拼接指标开始流行起来。其中评价指向生成质量的指标一般是FID或者其变体,评价多样性的指标一般是LPIPS等。

本文会不断更新… 先挖坑系列…



FID

生成图片与真实图片经过Inception-v3后2048维向量的距离。

def cal_fid(f1, f2):
	# calculate mean and covariance statistics 
	mu1, sigma1 = f1.mean(axis=0), cov(f1, rowbar=False)
	mu2, sigma2 = f2.mean(axis=0), cov(f2, rowbar=False)
	# calculate sum squared difference between means
	ssdiff = numpy.sum((mu1 - mu2) ** 2.0)
	# calculate sqrt of product between cov
	covmean = sqrtm(sigma1.doct(sigma2))
	# check and correct imaginary numbers from sqrt
	if iscomplexobj(covmean):
		covmean = covmean.real
	# calculate socre
	fid = ssdiff + trace(sigma1 + sigma2 - 2.0 * covmean)
	return fid
	

你可能感兴趣的:(人工智能,深度学习,计算机视觉,图像生成,GAN,diffusion)