Skip to content

Commit

Permalink
further cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
ssundaram21 committed Aug 18, 2024
1 parent d243d99 commit becf40b
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 574 deletions.
20 changes: 11 additions & 9 deletions evaluation/eval_datasets.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import os
import glob
import numpy as np
from PIL import Image
from torch.utils.data import Dataset
from util.utils import get_preprocess_fn
from torchvision import transforms
import pandas as pd
import numpy as np
from PIL import Image
import os
from typing import Callable
import torch
import glob

IMAGE_EXTENSIONS = ["jpg", "png", "JPEG", "jpeg"]


class ThingsDataset(Dataset):
"""
txt_file is expected to be the things_valset.txt list of triplets from the THINGS dataset.
root_dir is expected to be a directory of THINGS images.
"""
def __init__(self, root_dir: str, txt_file: str, preprocess: str, load_size: int = 224,
interpolation: transforms.InterpolationMode = transforms.InterpolationMode.BICUBIC):
with open(txt_file, "r") as f:
Expand All @@ -37,10 +37,12 @@ def __getitem__(self, idx):
return im_1, im_2, im_3



class BAPPSDataset(Dataset):
def __init__(self, root_dir: str, preprocess: str, load_size: int = 224,
interpolation: transforms.InterpolationMode = transforms.InterpolationMode.BICUBIC):
"""
root_dir is expected to be the default validation folder of the BAPPS dataset.
"""
data_types = ["cnn", "traditional", "color", "deblur", "superres", "frameinterp"]

self.preprocess_fn = get_preprocess_fn(preprocess, load_size, interpolation)
Expand Down
20 changes: 6 additions & 14 deletions evaluation/eval_percep.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
from pytorch_lightning import seed_everything
import torch
from dataset.dataset import TwoAFCDataset
from util.utils import get_preprocess
from torch.utils.data import DataLoader
import os
import yaml
import logging
import json
import torch
import configargparse
from torch.utils.data import DataLoader
from pytorch_lightning import seed_everything
from dreamsim import PerceptualModel
from dataset.dataset import TwoAFCDataset
from training.train import LightningPerceptualModel
from evaluation.score import score_nights_dataset, score_things_dataset, score_bapps_dataset
from evaluation.eval_datasets import ThingsDataset, BAPPSDataset
from torchmetrics.functional import structural_similarity_index_measure, peak_signal_noise_ratio
from DISTS_pytorch import DISTS
from dreamsim import PerceptualModel
from tqdm import tqdm
import pickle
import configargparse
from dreamsim import dreamsim
import clip
from torchvision import transforms

log = logging.getLogger("lightning.pytorch")
log.propagate = False
Expand Down
122 changes: 0 additions & 122 deletions evaluation/eval_util.py

This file was deleted.

Loading

0 comments on commit becf40b

Please sign in to comment.