From a9343acc51843b7fce0de9f48f2d7edd2ae31dcf Mon Sep 17 00:00:00 2001 From: Davis King Date: Sat, 25 Jun 2016 12:31:59 -0400 Subject: [PATCH] Changed code so the validation listing file doesn't have to be in the imagenet root folder. --- examples/dnn_imagenet_train_ex.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/dnn_imagenet_train_ex.cpp b/examples/dnn_imagenet_train_ex.cpp index 4428f3b2c..fe2765524 100644 --- a/examples/dnn_imagenet_train_ex.cpp +++ b/examples/dnn_imagenet_train_ex.cpp @@ -161,6 +161,7 @@ std::vector get_imagenet_train_listing( } std::vector get_imagenet_val_listing( + const std::string& imagenet_root_dir, const std::string& validation_images_file ) { @@ -169,10 +170,9 @@ std::vector get_imagenet_val_listing( std::vector results; image_info temp; temp.numeric_label = -1; - string path = get_parent_directory(file(validation_images_file)); while(fin >> label >> filename) { - temp.filename = path+"/"+filename; + temp.filename = imagenet_root_dir+"/"+filename; if (!file_exists(temp.filename)) { cerr << "file doesn't exist! " << temp.filename << endl; @@ -309,7 +309,7 @@ int main(int argc, char** argv) try int num_wrong_top1 = 0; dlib::rand rnd(time(0)); // loop over all the imagenet validation images - for (auto l : get_imagenet_val_listing(argv[2])) + for (auto l : get_imagenet_val_listing(argv[1], argv[2])) { dlib::array> images; matrix img;