Skip to content

Commit

Permalink
skip already processed folders
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Zotti authored and Ryan Zotti committed Oct 9, 2016
1 parent 5e6647b commit e18fb11
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions save_all_runs_as_numpy_files.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
from dataprep import video_to_rgb_npz, make_gamma_tables, process_session
import os
from util import shell_command

data_path = '/Users/ryanzotti/Documents/repos/Self_Driving_RC_Car/data'
data_folders = os.listdir(data_path)
gamma_map = make_gamma_tables([1]) # I should refactor-out the gamma at some point. It's not needed here
rgb = True

for folder in data_folders:
predictors, targets = process_session(data_path + '/' + folder, gamma_map, rgb)
video_to_rgb_npz(data_path + '/' + folder,predictors,targets)
print("saved folder: "+str(folder))

cmd = 'ls '+data_path + '/' + folder
dir_contents = str(shell_command(cmd))
print("Started work on "+str(folder))
print(dir_contents)
if 'predictors_and_targets.npz' not in dir_contents:
predictors, targets = process_session(data_path + '/' + folder, gamma_map, rgb)
video_to_rgb_npz(data_path + '/' + folder,predictors,targets)
print("Completed work on: "+str(folder)+". Created new npz file.")
else:
print("Completed work on "+str(dir)+". File already exists. No processing necessary.")
print("Finished.")

0 comments on commit e18fb11

Please sign in to comment.