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 |
| 13 | { |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 14 | using DataType = float; |
| 15 | using DatabaseType = CaffePreprocessor; |
| 16 | using ParserType = armnnCaffeParser::ICaffeParser; |
| 17 | using ModelType = InferenceModel<ParserType, DataType>; |
| 18 | |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 19 | // Coverity fix: ClassifierInferenceTestMain() may throw uncaught exceptions. |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 20 | retVal = armnn::test::ClassifierInferenceTestMain<DatabaseType, ParserType>( |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 21 | argc, argv, "bvlc_alexnet_1.caffemodel", true, "data", "prob", { 0 }, |
telsoa01 | c577f2c | 2018-08-31 09:22:23 +0100 | [diff] [blame] | 22 | [](const char* dataDir, const ModelType &) { |
| 23 | return DatabaseType(dataDir); |
| 24 | }); |
surmeh01 | 3537c2c | 2018-05-18 16:31:43 +0100 | [diff] [blame] | 25 | } |
| 26 | catch (const std::exception& e) |
| 27 | { |
| 28 | // Coverity fix: BOOST_LOG_TRIVIAL (typically used to report errors) may throw an |
| 29 | // exception of type std::length_error. |
| 30 | // Using stderr instead in this context as there is no point in nesting try-catch blocks here. |
| 31 | std::cerr << "WARNING: CaffeAlexNet-Armnn: An error has occurred when running the " |
| 32 | "classifier inference tests: " << e.what() << std::endl; |
| 33 | } |
| 34 | return retVal; |
telsoa01 | 4fcda01 | 2018-03-09 14:13:49 +0000 | [diff] [blame] | 35 | } |