Added --files

This commit is contained in:
Davis King 2016-07-30 17:19:20 -04:00
parent 26c727c79e
commit f77ca0c754
1 changed files with 25 additions and 1 deletions

View File

@ -737,6 +737,7 @@ int main(int argc, char** argv)
"about <arg> pixels (default 8000).",1); "about <arg> pixels (default 8000).",1);
parser.add_option("l","List all the labels in the given XML file."); parser.add_option("l","List all the labels in the given XML file.");
parser.add_option("stats","List detailed statistics on the object labels in the given XML file."); parser.add_option("stats","List detailed statistics on the object labels in the given XML file.");
parser.add_option("files","List all the files in the given XML file.");
parser.set_group_name("Editing/Transforming XML files"); parser.set_group_name("Editing/Transforming XML files");
parser.add_option("rename", "Rename all labels of <arg1> to <arg2>.",2); parser.add_option("rename", "Rename all labels of <arg1> to <arg2>.",2);
@ -770,7 +771,7 @@ int main(int argc, char** argv)
parser.parse(argc, argv); parser.parse(argc, argv);
const char* singles[] = {"h","c","r","l","convert","parts","rmdiff", "rmtrunc", "rmdupes", "seed", "shuffle", "split", "add", const char* singles[] = {"h","c","r","l","files","convert","parts","rmdiff", "rmtrunc", "rmdupes", "seed", "shuffle", "split", "add",
"flip", "rotate", "tile", "size", "cluster", "resample", "extract-chips"}; "flip", "rotate", "tile", "size", "cluster", "resample", "extract-chips"};
parser.check_one_time_options(singles); parser.check_one_time_options(singles);
const char* c_sub_ops[] = {"r", "convert"}; const char* c_sub_ops[] = {"r", "convert"};
@ -779,6 +780,7 @@ int main(int argc, char** argv)
const char* size_parent_ops[] = {"tile", "cluster"}; const char* size_parent_ops[] = {"tile", "cluster"};
parser.check_sub_options(size_parent_ops, "size"); parser.check_sub_options(size_parent_ops, "size");
parser.check_incompatible_options("c", "l"); parser.check_incompatible_options("c", "l");
parser.check_incompatible_options("c", "files");
parser.check_incompatible_options("c", "rmdiff"); parser.check_incompatible_options("c", "rmdiff");
parser.check_incompatible_options("c", "rmdupes"); parser.check_incompatible_options("c", "rmdupes");
parser.check_incompatible_options("c", "rmtrunc"); parser.check_incompatible_options("c", "rmtrunc");
@ -798,6 +800,12 @@ int main(int argc, char** argv)
parser.check_incompatible_options("l", "parts"); parser.check_incompatible_options("l", "parts");
parser.check_incompatible_options("l", "flip"); parser.check_incompatible_options("l", "flip");
parser.check_incompatible_options("l", "rotate"); parser.check_incompatible_options("l", "rotate");
parser.check_incompatible_options("files", "rename");
parser.check_incompatible_options("files", "ignore");
parser.check_incompatible_options("files", "add");
parser.check_incompatible_options("files", "parts");
parser.check_incompatible_options("files", "flip");
parser.check_incompatible_options("files", "rotate");
parser.check_incompatible_options("add", "flip"); parser.check_incompatible_options("add", "flip");
parser.check_incompatible_options("add", "rotate"); parser.check_incompatible_options("add", "rotate");
parser.check_incompatible_options("add", "tile"); parser.check_incompatible_options("add", "tile");
@ -817,6 +825,7 @@ int main(int argc, char** argv)
parser.check_incompatible_options("add", "extract-chips"); parser.check_incompatible_options("add", "extract-chips");
parser.check_incompatible_options("shuffle", "tile"); parser.check_incompatible_options("shuffle", "tile");
parser.check_incompatible_options("convert", "l"); parser.check_incompatible_options("convert", "l");
parser.check_incompatible_options("convert", "files");
parser.check_incompatible_options("convert", "rename"); parser.check_incompatible_options("convert", "rename");
parser.check_incompatible_options("convert", "ignore"); parser.check_incompatible_options("convert", "ignore");
parser.check_incompatible_options("convert", "parts"); parser.check_incompatible_options("convert", "parts");
@ -1002,6 +1011,21 @@ int main(int argc, char** argv)
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
if (parser.option("files"))
{
if (parser.number_of_arguments() != 1)
{
cerr << "The --files option requires you to give one XML file on the command line." << endl;
return EXIT_FAILURE;
}
dlib::image_dataset_metadata::dataset data;
load_image_dataset_metadata(data, parser[0]);
for (size_t i = 0; i < data.images.size(); ++i)
cout << data.images[i].filename << "\n";
return EXIT_SUCCESS;
}
if (parser.option("split")) if (parser.option("split"))
{ {
return split_dataset(parser); return split_dataset(parser);