surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
David Beck | ecb56cd | 2018-09-05 12:52:57 +0100 | [diff] [blame] | 3 | // SPDX-License-Identifier: MIT |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 4 | // |
| 5 | #include "../InferenceTest.hpp" |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 6 | #include "../CaffePreprocessor.hpp" |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 7 | #include "armnnTfParser/ITfParser.hpp" |
| 8 | |
| 9 | int main(int argc, char* argv[]) |
| 10 | { |
| 11 | int retVal = EXIT_FAILURE; |
| 12 | try |
| 13 | { |
| 14 | // Coverity fix: The following code may throw an exception of type std::length_error. |
| 15 | std::vector<ImageSet> imageSet = |
| 16 | { |
| 17 | {"ILSVRC2012_val_00000018.JPEG", 21 }, |
| 18 | {"shark.jpg", 2} |
| 19 | }; |
| 20 | |
| 21 | armnn::TensorShape inputTensorShape({ 1, 3, 224, 224 }); |
| 22 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 23 | using DataType = float; |
| 24 | using DatabaseType = CaffePreprocessor; |
| 25 | using ParserType = armnnTfParser::ITfParser; |
| 26 | using ModelType = InferenceModel<ParserType, DataType>; |
| 27 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 28 | // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions. |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 29 | retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>( |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 30 | argc, argv, "resnext_TF_quantized_for_armnn_team.pb", true, |
| 31 | "inputs", "pool1", { 0, 1 }, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 32 | [&imageSet](const char* dataDir, const ModelType &) { |
| 33 | return DatabaseType(dataDir, 224, 224, imageSet); |
| 34 | }, |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 35 | &inputTensorShape); |
| 36 | } |
| 37 | catch (const std::exception& e) |
| 38 | { |
| 39 | // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an |
| 40 | // exception of type std::length_error. |
| 41 | // Using stderr instead in this context as there is no point in nesting try-catch blocks here. |
| 42 | std::cerr << "WARNING: TfResNext_Quantized-Armnn: An error has occurred when running " |
| 43 | "the classifier inference tests: " << e.what() << std::endl; |
| 44 | } |
| 45 | return retVal; |
| 46 | } |