Commit 301525df authored by Matt Harvey's avatar Matt Harvey
Browse files

Fix more paths

Showing with 9 additions and 8 deletions
+9 -8
......@@ -22,7 +22,7 @@ class DataSet():
"""
self.seq_length = seq_length
self.class_limit = class_limit
self.sequence_path = './data/sequences/'
self.sequence_path = os.path.join('data', 'sequences')
self.max_frames = 300 # max number of frames a video can have for us to use it
# Get the data.
......@@ -39,7 +39,7 @@ class DataSet():
@staticmethod
def get_data():
"""Load our data from file."""
with open('./data/data_file.csv', 'r') as fin:
with open(os.path.join('data', 'data_file.csv'), 'r') as fin:
reader = csv.reader(fin)
data = list(reader)
......@@ -203,14 +203,14 @@ class DataSet():
def get_frames_for_sample(sample):
"""Given a sample row from the data file, get all the corresponding frame
filenames."""
path = './data/' + sample[0] + '/' + sample[1] + '/'
path = os.path.join('data', sample[0], sample[1])
filename = sample[2]
images = sorted(glob.glob(path + filename + '*jpg'))
images = sorted(glob.glob(os.path.join(path, filename + '*jpg')))
return images
@staticmethod
def get_filename_from_image(filename):
parts = filename.split('/')
parts = filename.split(os.path.sep)
return parts[-1].replace('.jpg', '')
@staticmethod
......
......@@ -32,8 +32,8 @@ pbar = tqdm(total=len(data.data))
for video in data.data:
# Get the path to the sequence for this video.
path = './data/sequences/' + video[2] + '-' + str(seq_length) + \
'-features.txt'
path = os.path.join('data', 'sequences', video[2] + '-' + str(seq_length) + \
'-features.txt')
# Check if we already have it.
if os.path.isfile(path):
......
......@@ -5,6 +5,7 @@ import numpy as np
import operator
import random
import glob
import os.path
from data import DataSet
from processor import process_image
from keras.models import load_model
......@@ -15,7 +16,7 @@ def main(nb_images=5):
model = load_model('data/checkpoints/inception.057-1.16.hdf5')
# Get all our test images.
images = glob.glob('./data/test/**/*.jpg')
images = glob.glob(os.path.join('data', 'test', '**', '*.jpg'))
for _ in range(nb_images):
print('-'*80)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment