X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=documentation%2Fvalidation_2_c_l_2_s_y_s_t_e_m_2_alex_net_8cpp_source.xhtml;h=5d29c6aeb274cc49d576c9a5ff254788097c35a5;hb=HEAD;hp=3398cd5539401f736672043b0a739d04e55225c0;hpb=67c8c91522e5be8156b77f57e63c0253535c902a;p=platform%2Fupstream%2Farmcl.git diff --git a/documentation/validation_2_c_l_2_s_y_s_t_e_m_2_alex_net_8cpp_source.xhtml b/documentation/validation_2_c_l_2_s_y_s_t_e_m_2_alex_net_8cpp_source.xhtml index 3398cd5..5d29c6a 100644 --- a/documentation/validation_2_c_l_2_s_y_s_t_e_m_2_alex_net_8cpp_source.xhtml +++ b/documentation/validation_2_c_l_2_s_y_s_t_e_m_2_alex_net_8cpp_source.xhtml @@ -40,7 +40,7 @@
Compute Library -  18.03 +  18.05
@@ -117,7 +117,7 @@ $(document).ready(function(){initNavTree('validation_2_c_l_2_s_y_s_t_e_m_2_alex_
AlexNet.cpp
-Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 ARM Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
32 #include "tests/CL/CLAccessor.h"
34 #include "tests/framework/Macros.h"
37 
38 #include <string>
39 #include <vector>
40 
41 namespace arm_compute
42 {
43 namespace test
44 {
45 namespace validation
46 {
47 namespace
48 {
49 using CLAlexNetModel = networks::AlexNetNetwork<ICLTensor,
50  CLTensor,
51  CLSubTensor,
52  CLAccessor,
53  CLActivationLayer,
54  CLConvolutionLayer,
55  CLDirectConvolutionLayer,
56  CLFullyConnectedLayer,
57  CLNormalizationLayer,
58  CLPoolingLayer,
59  CLSoftmaxLayer>;
60 std::vector<unsigned int> compute_alexnet(DataType dt, unsigned int batches, std::string input_file)
61 {
62  std::vector<std::string> weight_files = { "cnn_data/alexnet_model/conv1_w.npy",
63  "cnn_data/alexnet_model/conv2_w.npy",
64  "cnn_data/alexnet_model/conv3_w.npy",
65  "cnn_data/alexnet_model/conv4_w.npy",
66  "cnn_data/alexnet_model/conv5_w.npy",
67  "cnn_data/alexnet_model/fc6_w.npy",
68  "cnn_data/alexnet_model/fc7_w.npy",
69  "cnn_data/alexnet_model/fc8_w.npy"
70  };
71 
72  std::vector<std::string> bias_files = { "cnn_data/alexnet_model/conv1_b.npy",
73  "cnn_data/alexnet_model/conv2_b.npy",
74  "cnn_data/alexnet_model/conv3_b.npy",
75  "cnn_data/alexnet_model/conv4_b.npy",
76  "cnn_data/alexnet_model/conv5_b.npy",
77  "cnn_data/alexnet_model/fc6_b.npy",
78  "cnn_data/alexnet_model/fc7_b.npy",
79  "cnn_data/alexnet_model/fc8_b.npy"
80  };
81  CLAlexNetModel network{};
82  network.init(dt, 4, batches);
83  network.build();
84  network.allocate();
85  network.fill(weight_files, bias_files);
86  network.feed(std::move(input_file));
87  network.run();
88 
89  return network.get_classifications();
90 }
91 } // namespace
92 
93 TEST_SUITE(CL)
94 TEST_SUITE(SYSTEM_TESTS)
95 
96 TEST_CASE(AlexNet, framework::DatasetMode::PRECOMMIT)
97 {
98  // Compute alexnet
99  std::vector<unsigned int> classified_labels = compute_alexnet(DataType::F32, 1, "cnn_data/imagenet_data/cat.npy");
100 
101  // Expected labels
102  std::vector<unsigned int> expected_labels = { 281 };
103 
104  // Validate labels
105  validate(classified_labels, expected_labels);
106 }
107 
110 } // namespace validation
111 } // namespace test
112 } // namespace arm_compute
+Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 ARM Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
32 #include "tests/CL/CLAccessor.h"
34 #include "tests/framework/Macros.h"
37 
38 #include <string>
39 #include <vector>
40 
41 namespace arm_compute
42 {
43 namespace test
44 {
45 namespace validation
46 {
47 namespace
48 {
49 using CLAlexNetModel = networks::AlexNetNetwork<ICLTensor,
50  CLTensor,
51  CLSubTensor,
52  CLAccessor,
53  CLActivationLayer,
54  CLConvolutionLayer,
55  CLDirectConvolutionLayer,
56  CLFullyConnectedLayer,
57  CLNormalizationLayer,
58  CLPoolingLayer,
59  CLSoftmaxLayer>;
60 std::vector<unsigned int> compute_alexnet(DataType dt, unsigned int batches, std::string input_file)
61 {
62  std::vector<std::string> weight_files = { "cnn_data/alexnet_model/conv1_w.npy",
63  "cnn_data/alexnet_model/conv2_w.npy",
64  "cnn_data/alexnet_model/conv3_w.npy",
65  "cnn_data/alexnet_model/conv4_w.npy",
66  "cnn_data/alexnet_model/conv5_w.npy",
67  "cnn_data/alexnet_model/fc6_w.npy",
68  "cnn_data/alexnet_model/fc7_w.npy",
69  "cnn_data/alexnet_model/fc8_w.npy"
70  };
71 
72  std::vector<std::string> bias_files = { "cnn_data/alexnet_model/conv1_b.npy",
73  "cnn_data/alexnet_model/conv2_b.npy",
74  "cnn_data/alexnet_model/conv3_b.npy",
75  "cnn_data/alexnet_model/conv4_b.npy",
76  "cnn_data/alexnet_model/conv5_b.npy",
77  "cnn_data/alexnet_model/fc6_b.npy",
78  "cnn_data/alexnet_model/fc7_b.npy",
79  "cnn_data/alexnet_model/fc8_b.npy"
80  };
81  CLAlexNetModel network{};
82  network.init(dt, 4, batches);
83  network.build();
84  network.allocate();
85  network.fill(weight_files, bias_files);
86  network.feed(std::move(input_file));
87  network.run();
88 
89  return network.get_classifications();
90 }
91 } // namespace
92 
93 TEST_SUITE(CL)
94 TEST_SUITE(SYSTEM_TESTS)
95 
96 TEST_CASE(AlexNet, framework::DatasetMode::PRECOMMIT)
97 {
98  // Compute alexnet
99  std::vector<unsigned int> classified_labels = compute_alexnet(DataType::F32, 1, "cnn_data/imagenet_data/cat.npy");
100 
101  // Expected labels
102  std::vector<unsigned int> expected_labels = { 281 };
103 
104  // Validate labels
105  validate(classified_labels, expected_labels);
106 }
107 
110 } // namespace validation
111 } // namespace test
112 } // namespace arm_compute
1 channel, 1 F32 per channel
TEST_CASE(Configuration, framework::DatasetMode::ALL)
@@ -129,7 +129,6 @@ $(document).ready(function(){initNavTree('validation_2_c_l_2_s_y_s_t_e_m_2_alex_ -
ICLImage ICLTensor
Definition: CLHistogram.h:34
TEST_SUITE_END() DATA_TEST_CASE(Configuration
@@ -145,7 +144,7 @@ $(document).ready(function(){initNavTree('validation_2_c_l_2_s_y_s_t_e_m_2_alex_