-
Notifications
You must be signed in to change notification settings - Fork 50
/
dataset.py
executable file
·30 lines (26 loc) · 917 Bytes
/
dataset.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
"""Implements a dataset class for handling image data"""
from utils.image_utils import imread, imsave
DATA_PATH_BASE = '/home/VoxelFlow/dataset/ucf101_triplets/'
class Dataset(object):
def __init__(self, data_list_file=None, process_func=None):
"""
Args:
"""
self.data_list_file = data_list_file
if process_func:
self.process_func = process_func
else:
self.process_func = self.process_func
def read_data_list_file(self):
"""Reads the data list_file into python list
"""
f = open(self.data_list_file)
data_list = [DATA_PATH_BASE+line.rstrip() for line in f]
self.data_list = data_list
return data_list
def process_func(self, example_line):
"""Process the single example line and return data
Default behavior, assumes each line is the path to a single image.
This is used to train a VAE.
"""
return imread(example_line)