From e32a3c8591d594e34d2c81833de21661e5c33946 Mon Sep 17 00:00:00 2001 From: meidlinga Date: Sat, 1 Oct 2022 18:15:39 +0200 Subject: [PATCH] feat: Expect path to images and output as CLI args Additionally the path to the script programatically, instead of hardcoded --- classify_images.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/classify_images.py b/classify_images.py index 5f57685..c0ebb09 100644 --- a/classify_images.py +++ b/classify_images.py @@ -43,6 +43,10 @@ # Species classification modules will be imported later +if len(sys.argv) < 2: + print('Usage: %s '%sys.argv[0]) + + exit(1) #%% Options @@ -50,7 +54,7 @@ # little path management. This also implicitly defers PyTorch imports. # Directory to which you sync'd this repo. -api_root = r'/home/coyote/git/speciesclassification' +api_root = os.path.dirname(__file__) # If not None, pre-pended to filenames. Most useful when filenames are coming from # a .csv file. @@ -68,10 +72,10 @@ # images_to_classify = r'/data/species-classification/elephant.jpg' # images_to_classify = [r'/data/species-classification/elephant.jpg'] # images_to_classify = 'image_list.csv' -images_to_classify = r'/data/species-classification/images/sample_images.2019.12.28' +images_to_classify = sys.argv[1] # Classification results will be written here -classification_output_file = '/data/species-classification/classification_output.csv' +classification_output_file = sys.argv[2] # Path to taxa.csv, for latin --> common mapping #