• 2024-04-06334
    fromUtils.optionimport*fromdataimporttest_dataloaderfromUtils.utilsimport*fromUtils.metricsimport*#fromUtils.metricsimportssimasssimfromtorchvisionimportutilsasvutilsfrommodels.networkimportNetworkasNetimportlpipsfrom
  • 2024-03-2066
    importosimporttorchimporttorchvision.transforms.functionalasTFfromskimage.metricsimportpeak_signal_noise_ratioaspsnrfromskimage.metricsimportstructural_similarityasssimimportlpipsfromPILimportImagedefcalculate_metrics(folder1,
  • 2024-03-20psnr ssim lpips
    importosimporttorchimporttorchvision.transforms.functionalasTFfromskimage.metricsimportpeak_signal_noise_ratioaspsnrfromskimage.metricsimportstructural_similarityasssimimportlpipsfromPILimportImagedefcalculate_metrics(folder1,folder
  • 2024-03-19111
    importosimporttorchimportlpipsfromPILimportImage#初始化LPIPS模型loss_fn=lpips.LPIPS(net='vgg')defcalculate_lpips(folder1,folder2,ext1='.jpg',ext2='.png'):#获取文件夹中的文件名filenames=[fforfinos.listdi
  • 2024-03-14计算lpips
    importosimporttorchimportlpipsfromPILimportImagefromtorchvision.transformsimportToTensor#初始化LPIPS模型loss_fn=lpips.LPIPS(net='vgg')defcalculate_lpips(img_path1,img_path2):#读取图像img1=Image.open(img_path1)img2