Created
March 17, 2017 16:53
-
-
Save apacha/4cc2d85cef4c966a6cece61a91240b6c to your computer and use it in GitHub Desktop.
Path Tools
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
import inspect | |
import os | |
import sys | |
def get_solution_directory() -> str: | |
# Assumes that all scripts that are actually executed reside in a sub-folder of AssignmentX, | |
# e.g. Assignment2/TestScripts, therefore returns the parent of the currently executed file | |
solution_directory = os.path.realpath( | |
os.path.abspath(os.path.join(os.path.split(inspect.getfile(inspect.currentframe()))[0], ".."))) | |
return solution_directory | |
def get_dataset_directory() -> str: | |
return os.path.join(get_solution_directory(), "..", "Datasets") | |
def get_cifar10_directory() -> str: | |
return os.path.join(get_dataset_directory(), "cifar-10-batches-py") | |
def set_execution_environment_path(): | |
cmd_parent = get_solution_directory() | |
sys.path.append(cmd_parent) | |
print("Appending parent-path: {0}".format(cmd_parent)) | |
def get_cifar10_hog_directory() -> str: | |
return os.path.join(get_dataset_directory(), "cifar-10-hog-features") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment