2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
5 #include "../InferenceTest.hpp"
6 #include "../CaffePreprocessor.hpp"
7 #include "armnnCaffeParser/ICaffeParser.hpp"
9 int main(int argc, char* argv[])
11 int retVal = EXIT_FAILURE;
14 // Coverity fix: The following code may throw an exception of type std::length_error.
15 std::vector<ImageSet> imageSet =
17 {"ILSVRC2012_val_00000018.JPEG", 21 },
21 armnn::TensorShape inputTensorShape({ 1, 3, 224, 224 });
23 using DataType = float;
24 using DatabaseType = CaffePreprocessor;
25 using ParserType = armnnCaffeParser::ICaffeParser;
26 using ModelType = InferenceModel<ParserType, DataType>;
28 // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions.
29 retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
30 argc, argv, "ResNet_50_ilsvrc15_model.caffemodel", true,
31 "data", "prob", { 0, 1 },
32 [&imageSet](const char* dataDir, const ModelType&) {
33 return DatabaseType(dataDir, 224, 224, imageSet);
34 }, &inputTensorShape);
36 catch (const std::exception& e)
38 // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
39 // exception of type std::length_error.
40 // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
41 std::cerr << "WARNING: CaffeResNet-Armnn: An error has occurred when running "
42 "the classifier inference tests: " << e.what() << std::endl;