diff options
Diffstat (limited to 'Code/constants.py')
| -rw-r--r-- | Code/constants.py | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/Code/constants.py b/Code/constants.py index 761448b..5d5446b 100644 --- a/Code/constants.py +++ b/Code/constants.py @@ -42,18 +42,22 @@ def clear_dir(directory): except Exception as e: print(e) +def get_process_frame_dims(): + img_path = glob(os.path.join(PROCESS_DIR, '*'))[0] + img = imread(img_path, mode='RGB') + shape = np.shape(img) + return shape[0], shape[1] + def get_test_frame_dims(): img_path = glob(os.path.join(TEST_DIR, '*/*'))[0] img = imread(img_path, mode='RGB') shape = np.shape(img) - return shape[0], shape[1] def get_train_frame_dims(): img_path = glob(os.path.join(TRAIN_DIR, '*/*'))[0] img = imread(img_path, mode='RGB') shape = np.shape(img) - return shape[0], shape[1] def set_test_dir(directory): @@ -67,15 +71,28 @@ def set_test_dir(directory): TEST_DIR = directory FULL_HEIGHT, FULL_WIDTH = get_test_frame_dims() +def set_process_dir(directory): + """ + Edits all constants dependent on TEST_DIR. + + @param directory: The new test directory. + """ + global PROCESS_DIR, FULL_HEIGHT, FULL_WIDTH + + TEST_DIR = directory + FULL_HEIGHT, FULL_WIDTH = get_process_frame_dims() + # root directory for all data DATA_DIR = get_dir('../Data/') # directory of unprocessed training frames -TRAIN_DIR = os.path.join(DATA_DIR, 'Ms_Pacman/Train/') +TRAIN_DIR = os.path.join(DATA_DIR, 'WoodFlat/Train/') # directory of unprocessed test frames -TEST_DIR = os.path.join(DATA_DIR, 'Ms_Pacman/Test/') +TEST_DIR = os.path.join(DATA_DIR, 'WoodFlat/Test/') +# directory of all the images we want to process +PROCESS_DIR = os.path.join(DATA_DIR, 'WoodFlat/Process/') # Directory of processed training clips. # hidden so finder doesn't freeze w/ so many files. DON'T USE `ls` COMMAND ON THIS DIR! -TRAIN_DIR_CLIPS = get_dir(os.path.join(DATA_DIR, '.Clips/')) +TRAIN_DIR_CLIPS = get_dir(os.path.join(DATA_DIR, 'Clips/WoodClips/')) # For processing clips. l2 diff between frames must be greater than this MOVEMENT_THRESHOLD = 100 @@ -83,8 +100,8 @@ MOVEMENT_THRESHOLD = 100 NUM_CLIPS = len(glob(TRAIN_DIR_CLIPS + '*')) # the height and width of the full frames to test on. Set in avg_runner.py or process_data.py main. -FULL_HEIGHT = 210 -FULL_WIDTH = 160 +FULL_HEIGHT = 320 +FULL_WIDTH = 180 # the height and width of the patches to train on TRAIN_HEIGHT = TRAIN_WIDTH = 32 |
