Laurent Carlier | 749294b | 2020-06-01 09:03:17 +0100 | [diff] [blame] | 1 | // |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 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 |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 4 | // |
| 5 | #include "../InferenceTest.hpp" |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 6 | #include "../CaffePreprocessor.hpp" |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 7 | #include "armnnCaffeParser/ICaffeParser.hpp" |
| 8 | |
| 9 | int main(int argc, char* argv[]) |
| 10 | { |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 11 | int retVal = EXIT_FAILURE; |
| 12 | try |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 13 | { |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 14 | // Coverity fix: The following code may throw an exception of type std::length_error. |
| 15 | std::vector<ImageSet> imageSet = |
| 16 | { |
| 17 | {"shark.jpg", 3694} |
| 18 | }; |
| 19 | |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 20 | using DataType = float; |
| 21 | using DatabaseType = CaffePreprocessor; |
| 22 | using ParserType = armnnCaffeParser::ICaffeParser; |
| 23 | using ModelType = InferenceModel<ParserType, DataType>; |
| 24 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 25 | // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions. |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 26 | retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>( |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 27 | argc, argv, "Inception-BN-batchsize1.caffemodel", true, |
| 28 | "data", "softmax", { 0 }, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 29 | [&imageSet](const char* dataDir, const ModelType&) { |
| 30 | return DatabaseType(dataDir, 224, 224, imageSet); |
| 31 | }); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 32 | } |
| 33 | catch (const std::exception& e) |
| 34 | { |
| 35 | // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an |
| 36 | // exception of type std::length_error. |
| 37 | // Using stderr instead in this context as there is no point in nesting try-catch blocks here. |
| 38 | std::cerr << "WARNING: CaffeInception_BN-Armnn: An error has occurred when running " |
| 39 | "the classifier inference tests: " << e.what() << std::endl; |
| 40 | } |
| 41 | return retVal; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 42 | } |