blob: 09e70018d3b3052daff34223b1fcf4cd9eb1fe54 [file] [log] [blame]
surmeh01bceff2f2018-03-29 16:29:27 +01001//
2// Copyright © 2017 Arm Ltd. All rights reserved.
3// See LICENSE file in the project root for full license information.
4//
5#include "../InferenceTest.hpp"
telsoa01c577f2c2018-08-31 09:22:23 +01006#include "../ImagePreprocessor.hpp"
surmeh01bceff2f2018-03-29 16:29:27 +01007#include "armnnTfParser/ITfParser.hpp"
8
9int main(int argc, char* argv[])
10{
surmeh013537c2c2018-05-18 16:31:43 +010011 int retVal = EXIT_FAILURE;
12 try
surmeh01bceff2f2018-03-29 16:29:27 +010013 {
surmeh013537c2c2018-05-18 16:31:43 +010014 // Coverity fix: The following code may throw an exception of type std::length_error.
15 std::vector<ImageSet> imageSet =
16 {
17 { "Dog.jpg", 208 },
18 { "Cat.jpg", 283 },
19 { "shark.jpg", 3 },
20 };
21
22 armnn::TensorShape inputTensorShape({ 1, 299, 299, 3 });
23
telsoa01c577f2c2018-08-31 09:22:23 +010024 using DataType = float;
25 using DatabaseType = ImagePreprocessor<float>;
26 using ParserType = armnnTfParser::ITfParser;
27 using ModelType = InferenceModel<ParserType, DataType>;
28
surmeh013537c2c2018-05-18 16:31:43 +010029 // Coverity fix: InferenceTestMain() may throw uncaught exceptions.
telsoa01c577f2c2018-08-31 09:22:23 +010030 retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>(
surmeh013537c2c2018-05-18 16:31:43 +010031 argc, argv, "inception_v3_2016_08_28_frozen_transformed.pb", true,
32 "input", "InceptionV3/Predictions/Reshape_1", { 0, 1, 2, },
telsoa01c577f2c2018-08-31 09:22:23 +010033 [&imageSet](const char* dataDir, const ModelType&) {
34 return DatabaseType(dataDir, 299, 299, imageSet);
35 },
surmeh013537c2c2018-05-18 16:31:43 +010036 &inputTensorShape);
37 }
38 catch (const std::exception& e)
39 {
40 // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an
41 // exception of type std::length_error.
42 // Using stderr instead in this context as there is no point in nesting try-catch blocks here.
43 std::cerr << "WARNING: TfInceptionV3-Armnn: An error has occurred when running "
44 "the classifier inference tests: " << e.what() << std::endl;
45 }
46 return retVal;
surmeh01bceff2f2018-03-29 16:29:27 +010047}