aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMatthew Sloyan <matthew.sloyan@arm.com>2020-09-28 12:58:14 +0100
committerMatthew Sloyan <matthew.sloyan@arm.com>2020-10-09 09:31:40 +0000
commit0029cd64a4ab425ec00c498482eac0f06a8f3aa8 (patch)
treef7b90479e5e737c3d33937adb17f6e9c1d624ac2 /tests
parent3a40ea5e1efd61ebb21a174ef7bf9adecac8ade9 (diff)
downloadarmnn-0029cd64a4ab425ec00c498482eac0f06a8f3aa8.tar.gz
IVGCVSW-5282 Switch tests/TfLiteMobilenetQuantized-Armnn over to cxxopts
* Required update to cxxopts v3.0 for unrecognised options to work. Signed-off-by: Matthew Sloyan <matthew.sloyan@arm.com> Change-Id: If1803731474e42580d663c802a1f3ff240fadffe
Diffstat (limited to 'tests')
-rw-r--r--tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp39
1 files changed, 26 insertions, 13 deletions
diff --git a/tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp b/tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
index b2d3f0f3f5..56b145d6ee 100644
--- a/tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
+++ b/tests/TfLiteMobilenetQuantized-Armnn/TfLiteMobilenetQuantized-Armnn.cpp
@@ -6,7 +6,7 @@
#include "../ImagePreprocessor.hpp"
#include "armnnTfLiteParser/ITfLiteParser.hpp"
-#include "boost/program_options.hpp"
+#include <cxxopts/cxxopts.hpp>
#include <fstream>
using namespace armnnTfLiteParser;
@@ -61,20 +61,33 @@ std::vector<ImageSet> ParseDataset(const std::string& filename)
std::string GetLabelsFilenameFromOptions(int argc, char* argv[])
{
- namespace po = boost::program_options;
- po::options_description desc("Validation Options");
- std::string fn("");
- desc.add_options()
- ("labels", po::value<std::string>(&fn), "Filename of a text file where in each line contains an image "
- "filename and the correct label the network should predict when fed that image");
- po::variables_map vm;
- po::parsed_options parsed = po::command_line_parser(argc, argv).options(desc).allow_unregistered().run();
- po::store(parsed, vm);
- if (vm.count("labels"))
+ cxxopts::Options options("TfLiteMobilenetQuantized-Armnn","Validation Options");
+
+ std::string fileName;
+ try
+ {
+ options
+ .allow_unrecognised_options()
+ .add_options()
+ ("l,labels",
+ "Filename of a text file where in each line contains an image "
+ "filename and the correct label the network should predict when fed that image",
+ cxxopts::value<std::string>(fileName));
+
+ auto result = options.parse(argc, argv);
+ }
+ catch (const cxxopts::OptionException& e)
{
- fn = vm["labels"].as<std::string>();
+ std::cerr << e.what() << std::endl;
+ exit(EXIT_FAILURE);
}
- return fn;
+ catch (const std::exception& e)
+ {
+ std::cerr << "Fatal internal error: [" << e.what() << "]" << std::endl;
+ exit(EXIT_FAILURE);
+ }
+
+ return fileName;
}