-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
126 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-cayman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import os | ||
|
||
import torch | ||
from torch.utils.data import Dataset, DataLoader | ||
from torchvision import transforms | ||
from PIL import Image | ||
|
||
class SNUFILM(Dataset): | ||
def __init__(self, data_root, mode='hard'): | ||
''' | ||
:param data_root: ./data/SNU-FILM | ||
:param mode: ['easy', 'medium', 'hard', 'extreme'] | ||
''' | ||
test_root = os.path.join(data_root, 'test') | ||
test_fn = os.path.join(data_root, 'test-%s.txt' % mode) | ||
with open(test_fn, 'r') as f: | ||
self.frame_list = f.read().splitlines() | ||
self.frame_list = [v.split(' ') for v in self.frame_list] | ||
|
||
self.transforms = transforms.Compose([ | ||
transforms.ToTensor() | ||
]) | ||
|
||
print("[%s] Test dataset has %d triplets" % (mode, len(self.frame_list))) | ||
|
||
|
||
def __getitem__(self, index): | ||
|
||
# Use self.test_all_images: | ||
imgpaths = self.frame_list[index] | ||
|
||
img1 = Image.open(imgpaths[0]) | ||
img2 = Image.open(imgpaths[1]) | ||
img3 = Image.open(imgpaths[2]) | ||
|
||
img1 = self.transforms(img1) | ||
img2 = self.transforms(img2) | ||
img3 = self.transforms(img3) | ||
|
||
imgs = [img1, img2, img3] | ||
|
||
return imgs, imgpaths | ||
|
||
def __len__(self): | ||
return len(self.frame_list) | ||
|
||
|
||
def check_already_extracted(vid): | ||
return bool(os.path.exists(vid + '/0001.png')) | ||
|
||
|
||
def get_loader(mode, data_root, batch_size, shuffle, num_workers, test_mode='hard'): | ||
# data_root = 'data/SNUFILM' | ||
dataset = SNUFILM(data_root, mode=test_mode) | ||
return DataLoader(dataset, batch_size=batch_size, shuffle=shuffle, num_workers=num_workers, pin_memory=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
CUDA_VISIBLE_DEVICES=1 python main.py \ | ||
--exp_name CAIN_eval \ | ||
--dataset snufilm \ | ||
--data_root data/SNU-FILM \ | ||
--test_batch_size 1 \ | ||
--model cain \ | ||
--depth 3 \ | ||
--mode test \ | ||
--resume \ | ||
--resume_exp CAIN_train \ | ||
--test_mode hard |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters