Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 1 | /* |
SiCong Li | 4841c97 | 2021-02-03 12:17:35 +0000 | [diff] [blame] | 2 | * Copyright (c) 2017-2021 Arm Limited. |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 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 | */ |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 24 | #include "arm_compute/graph.h" |
SiCongLi | f466d75 | 2021-03-01 15:26:18 +0000 | [diff] [blame] | 25 | #include "arm_compute/core/Types.h" |
| 26 | #include "arm_compute/core/Utils.h" |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 27 | #include "support/ToolchainSupport.h" |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 28 | #include "utils/CommonGraphOptions.h" |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 29 | #include "utils/GraphUtils.h" |
| 30 | #include "utils/Utils.h" |
| 31 | |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 32 | using namespace arm_compute::utils; |
Georgios Pinitas | d9eb275 | 2018-04-03 13:44:29 +0100 | [diff] [blame] | 33 | using namespace arm_compute::graph::frontend; |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 34 | using namespace arm_compute::graph_utils; |
| 35 | |
Georgios Pinitas | 108ab0b | 2018-09-14 18:35:11 +0100 | [diff] [blame] | 36 | /** Example demonstrating how to implement InceptionV3's network using the Compute Library's graph API */ |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 37 | class InceptionV3Example : public Example |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 38 | { |
| 39 | public: |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 40 | InceptionV3Example() |
| 41 | : cmd_parser(), common_opts(cmd_parser), common_params(), graph(0, "InceptionV3") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 42 | { |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 43 | } |
| 44 | bool do_setup(int argc, char **argv) override |
| 45 | { |
| 46 | // Parse arguments |
| 47 | cmd_parser.parse(argc, argv); |
Georgios Pinitas | cd60a5f | 2019-08-21 17:06:54 +0100 | [diff] [blame] | 48 | cmd_parser.validate(); |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 49 | |
| 50 | // Consume common parameters |
| 51 | common_params = consume_common_graph_parameters(common_opts); |
| 52 | |
| 53 | // Return when help menu is requested |
| 54 | if(common_params.help) |
| 55 | { |
| 56 | cmd_parser.print_help(argv[0]); |
| 57 | return false; |
| 58 | } |
| 59 | |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 60 | // Print parameter values |
| 61 | std::cout << common_params << std::endl; |
| 62 | |
| 63 | // Get trainable parameters data path |
| 64 | std::string data_path = common_params.data_path; |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 65 | |
Georgios Pinitas | 140fdc7 | 2018-02-16 11:42:38 +0000 | [diff] [blame] | 66 | // Create a preprocessor object |
Georgios Pinitas | 40f51a6 | 2020-11-21 03:04:18 +0000 | [diff] [blame] | 67 | std::unique_ptr<IPreprocessor> preprocessor = std::make_unique<TFPreproccessor>(); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 68 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 69 | // Create input descriptor |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 70 | const auto operation_layout = common_params.data_layout; |
| 71 | const TensorShape tensor_shape = permute_shape(TensorShape(299U, 299U, 3U, 1U), DataLayout::NCHW, operation_layout); |
| 72 | TensorDescriptor input_descriptor = TensorDescriptor(tensor_shape, common_params.data_type).set_layout(operation_layout); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 73 | |
| 74 | // Set weights trained layout |
| 75 | const DataLayout weights_layout = DataLayout::NCHW; |
| 76 | |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 77 | graph << common_params.target |
| 78 | << common_params.fast_math_hint |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 79 | << InputLayer(input_descriptor, get_input_accessor(common_params, std::move(preprocessor), false)) |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 80 | << ConvolutionLayer(3U, 3U, 32U, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 81 | get_weights_accessor(data_path, "/cnn_data/inceptionv3_model/Conv2d_1a_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 82 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(2, 2, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 83 | .set_name("Conv2d_1a_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 84 | << BatchNormalizationLayer(get_weights_accessor(data_path, |
| 85 | "/cnn_data/inceptionv3_model/Conv2d_1a_3x3_BatchNorm_moving_mean.npy"), |
| 86 | get_weights_accessor(data_path, |
| 87 | "/cnn_data/inceptionv3_model/Conv2d_1a_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 88 | nullptr, get_weights_accessor(data_path, |
| 89 | "/cnn_data/inceptionv3_model/Conv2d_1a_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 90 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 91 | .set_name("Conv2d_1a_3x3/BatchNorm/batchnorm") |
| 92 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("Conv2d_1a_3x3/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 93 | << ConvolutionLayer(3U, 3U, 32U, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 94 | get_weights_accessor(data_path, "/cnn_data/inceptionv3_model/Conv2d_2a_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 95 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 96 | .set_name("Conv2d_2a_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 97 | << BatchNormalizationLayer(get_weights_accessor(data_path, |
| 98 | "/cnn_data/inceptionv3_model/Conv2d_2a_3x3_BatchNorm_moving_mean.npy"), |
| 99 | get_weights_accessor(data_path, |
| 100 | "/cnn_data/inceptionv3_model/Conv2d_2a_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 101 | nullptr, get_weights_accessor(data_path, |
| 102 | "/cnn_data/inceptionv3_model/Conv2d_2a_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 103 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 104 | .set_name("Conv2d_2a_3x3/BatchNorm/batchnorm") |
| 105 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("Conv2d_2a_3x3/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 106 | |
| 107 | << ConvolutionLayer(3U, 3U, 64U, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 108 | get_weights_accessor(data_path, "/cnn_data/inceptionv3_model/Conv2d_2b_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 109 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 1, 1)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 110 | .set_name("Conv2d_2b_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 111 | << BatchNormalizationLayer(get_weights_accessor(data_path, |
| 112 | "/cnn_data/inceptionv3_model/Conv2d_2b_3x3_BatchNorm_moving_mean.npy"), |
| 113 | get_weights_accessor(data_path, |
| 114 | "/cnn_data/inceptionv3_model/Conv2d_2b_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 115 | nullptr, get_weights_accessor(data_path, |
| 116 | "/cnn_data/inceptionv3_model/Conv2d_2b_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 117 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 118 | .set_name("Conv2d_2b_3x3/BatchNorm/batchnorm") |
| 119 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("Conv2d_2b_3x3/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 120 | |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 121 | << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, operation_layout, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))).set_name("MaxPool_3a_3x3/MaxPool") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 122 | |
| 123 | << ConvolutionLayer(1U, 1U, 80U, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 124 | get_weights_accessor(data_path, "/cnn_data/inceptionv3_model/Conv2d_3b_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 125 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 126 | .set_name("Conv2d_3b_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 127 | << BatchNormalizationLayer(get_weights_accessor(data_path, |
| 128 | "/cnn_data/inceptionv3_model/Conv2d_3b_1x1_BatchNorm_moving_mean.npy"), |
| 129 | get_weights_accessor(data_path, |
| 130 | "/cnn_data/inceptionv3_model/Conv2d_3b_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 131 | nullptr, get_weights_accessor(data_path, |
| 132 | "/cnn_data/inceptionv3_model/Conv2d_3b_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 133 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 134 | .set_name("Conv2d_3b_1x1/BatchNorm/batchnorm") |
| 135 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("Conv2d_3b_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 136 | |
| 137 | << ConvolutionLayer(3U, 3U, 192U, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 138 | get_weights_accessor(data_path, "/cnn_data/inceptionv3_model/Conv2d_4a_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 139 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 140 | .set_name("Conv2d_4a_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 141 | << BatchNormalizationLayer(get_weights_accessor(data_path, |
| 142 | "/cnn_data/inceptionv3_model/Conv2d_4a_3x3_BatchNorm_moving_mean.npy"), |
| 143 | get_weights_accessor(data_path, |
| 144 | "/cnn_data/inceptionv3_model/Conv2d_4a_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 145 | nullptr, get_weights_accessor(data_path, |
| 146 | "/cnn_data/inceptionv3_model/Conv2d_4a_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 147 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 148 | .set_name("Conv2d_4a_3x3/BatchNorm/batchnorm") |
| 149 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name("Conv2d_4a_3x3/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 150 | |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 151 | << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, operation_layout, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))).set_name("MaxPool_5a_3x3/MaxPool"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 152 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 153 | graph << get_inception_node_A(data_path, "Mixed_5b", weights_layout, 64U, std::make_tuple(48U, 64U), std::make_tuple(64U, 96U, 96U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 154 | 32U) |
| 155 | .set_name("Mixed_5b/concat"); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 156 | graph << get_inception_node_A(data_path, "Mixed_5c", weights_layout, 64U, std::make_tuple(48U, 64U), std::make_tuple(64U, 96U, 96U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 157 | 64U, true) |
| 158 | .set_name("Mixed_5c/concat"); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 159 | graph << get_inception_node_A(data_path, "Mixed_5d", weights_layout, 64U, std::make_tuple(48U, 64U), std::make_tuple(64U, 96U, 96U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 160 | 64U) |
| 161 | .set_name("Mixed_5d/concat"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 162 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 163 | graph << get_inception_node_B(data_path, "Mixed_6a", weights_layout, 384U, std::make_tuple(64U, 96U, 96U)).set_name("Mixed_6a/concat"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 164 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 165 | graph << get_inception_node_C(data_path, "Mixed_6b", weights_layout, 192U, std::make_tuple(128U, 128U, 192U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 166 | std::make_tuple(128U, 128U, 128U, 128U, 192U), 192U) |
| 167 | .set_name("Mixed_6b/concat"); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 168 | graph << get_inception_node_C(data_path, "Mixed_6c", weights_layout, 192U, std::make_tuple(160U, 160U, 192U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 169 | std::make_tuple(160U, 160U, 160U, 160U, 192U), 192U) |
| 170 | .set_name("Mixed_6c/concat"); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 171 | graph << get_inception_node_C(data_path, "Mixed_6d", weights_layout, 192U, std::make_tuple(160U, 160U, 192U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 172 | std::make_tuple(160U, 160U, 160U, 160U, 192U), 192U) |
| 173 | .set_name("Mixed_6d/concat"); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 174 | graph << get_inception_node_C(data_path, "Mixed_6e", weights_layout, 192U, std::make_tuple(192U, 192U, 192U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 175 | std::make_tuple(192U, 192U, 192U, 192U, 192U), 192U) |
| 176 | .set_name("Mixed_6e/concat"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 177 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 178 | graph << get_inception_node_D(data_path, "Mixed_7a", weights_layout, std::make_tuple(192U, 320U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 179 | std::make_tuple(192U, 192U, 192U, 192U)) |
| 180 | .set_name("Mixed_7a/concat"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 181 | |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 182 | graph << get_inception_node_E(data_path, "Mixed_7b", weights_layout, 320U, std::make_tuple(384U, 384U, 384U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 183 | std::make_tuple(448U, 384U, 384U, 384U), 192U) |
| 184 | .set_name("Mixed_7b/concat"); |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 185 | graph << get_inception_node_E(data_path, "Mixed_7c", weights_layout, 320U, std::make_tuple(384U, 384U, 384U), |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 186 | std::make_tuple(448U, 384U, 384U, 384U), 192U, true) |
| 187 | .set_name("Mixed_7c/concat"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 188 | |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 189 | graph << PoolingLayer(PoolingLayerInfo(PoolingType::AVG, 8, operation_layout, PadStrideInfo(1, 1, 0, 0, DimensionRoundingType::CEIL))).set_name("Logits/AvgPool_1a_8x8/AvgPool") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 190 | << ConvolutionLayer(1U, 1U, 1001U, get_weights_accessor(data_path, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 191 | "/cnn_data/inceptionv3_model/Logits_Conv2d_1c_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 192 | get_weights_accessor(data_path, |
| 193 | "/cnn_data/inceptionv3_model/Logits_Conv2d_1c_1x1_biases.npy"), |
| 194 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 195 | .set_name("Logits/Conv2d_1c_1x1/convolution") |
| 196 | << ReshapeLayer(TensorShape(1001U)).set_name("Predictions/Reshape") |
| 197 | << SoftmaxLayer().set_name("Predictions/Softmax") |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 198 | << OutputLayer(get_output_accessor(common_params, 5)); |
Gian Marco | c1b6e37 | 2018-02-21 18:03:26 +0000 | [diff] [blame] | 199 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 200 | // Finalize graph |
Georgios Pinitas | 9a8c672 | 2018-03-21 17:52:35 +0000 | [diff] [blame] | 201 | GraphConfig config; |
SiCongLi | f466d75 | 2021-03-01 15:26:18 +0000 | [diff] [blame] | 202 | config.num_threads = common_params.threads; |
| 203 | config.use_tuner = common_params.enable_tuner; |
| 204 | config.tuner_mode = common_params.tuner_mode; |
| 205 | config.tuner_file = common_params.tuner_file; |
| 206 | config.mlgo_file = common_params.mlgo_file; |
| 207 | config.use_synthetic_type = arm_compute::is_data_type_quantized(common_params.data_type); |
| 208 | config.synthetic_type = common_params.data_type; |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 209 | graph.finalize(common_params.target, config); |
| 210 | |
| 211 | return true; |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 212 | } |
| 213 | |
| 214 | void do_run() override |
| 215 | { |
| 216 | graph.run(); |
| 217 | } |
| 218 | |
| 219 | private: |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 220 | CommandLineParser cmd_parser; |
| 221 | CommonGraphOptions common_opts; |
| 222 | CommonGraphParams common_params; |
| 223 | Stream graph; |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 224 | |
| 225 | private: |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 226 | ConcatLayer get_inception_node_A(const std::string &data_path, std::string &¶m_path, DataLayout weights_layout, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 227 | unsigned int a_filt, |
| 228 | std::tuple<unsigned int, unsigned int> b_filters, |
| 229 | std::tuple<unsigned int, unsigned int, unsigned int> c_filters, |
| 230 | unsigned int d_filt, |
| 231 | bool is_name_different = false) |
| 232 | { |
| 233 | std::string total_path = "/cnn_data/inceptionv3_model/" + param_path + "_"; |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 234 | |
| 235 | // This is due to a naming issue in the tf model |
| 236 | std::string conv_id0 = "_0a_"; |
| 237 | std::string conv_id1 = "2d_0b_"; |
| 238 | if(is_name_different) |
| 239 | { |
| 240 | conv_id0 = "_0b_"; |
| 241 | conv_id1 = "_1_0c_"; |
| 242 | } |
| 243 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 244 | SubStream i_a(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 245 | i_a << ConvolutionLayer( |
| 246 | 1U, 1U, a_filt, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 247 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 248 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 249 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 250 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 251 | << BatchNormalizationLayer( |
| 252 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 253 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 254 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 255 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 256 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 257 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 258 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_0/Conv2d_0a_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 259 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 260 | SubStream i_b(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 261 | i_b << ConvolutionLayer( |
| 262 | 1U, 1U, std::get<0>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 263 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id0 + "1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 264 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 265 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 266 | .set_name(param_path + "/Branch_1/Conv2d" + conv_id0 + "1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 267 | << BatchNormalizationLayer( |
| 268 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id0 + "1x1_BatchNorm_moving_mean.npy"), |
| 269 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id0 + "1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 270 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 271 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id0 + "1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 272 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 273 | .set_name(param_path + "/Branch_1/Conv2d" + conv_id0 + "1x1/BatchNorm/batchnorm") |
| 274 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d" + conv_id0 + "1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 275 | << ConvolutionLayer( |
| 276 | 5U, 5U, std::get<1>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 277 | get_weights_accessor(data_path, total_path + "Branch_1_Conv" + conv_id1 + "5x5_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 278 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 279 | PadStrideInfo(1, 1, 2, 2)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 280 | .set_name(param_path + "/Branch_1/Conv2d" + conv_id1 + "5x5/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 281 | << BatchNormalizationLayer( |
| 282 | get_weights_accessor(data_path, total_path + "Branch_1_Conv" + conv_id1 + "5x5_BatchNorm_moving_mean.npy"), |
| 283 | get_weights_accessor(data_path, total_path + "Branch_1_Conv" + conv_id1 + "5x5_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 284 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 285 | get_weights_accessor(data_path, total_path + "Branch_1_Conv" + conv_id1 + "5x5_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 286 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 287 | .set_name(param_path + "/Branch_1/Conv2d" + conv_id1 + "5x5/BatchNorm/batchnorm") |
| 288 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d" + conv_id1 + "5x5/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 289 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 290 | SubStream i_c(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 291 | i_c << ConvolutionLayer( |
| 292 | 1U, 1U, std::get<0>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 293 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 294 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 295 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 296 | .set_name(param_path + "/Branch_2/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 297 | << BatchNormalizationLayer( |
| 298 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 299 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 300 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 301 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 302 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 303 | .set_name(param_path + "/Branch_2/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 304 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0a_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 305 | << ConvolutionLayer( |
| 306 | 3U, 3U, std::get<1>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 307 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 308 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 309 | PadStrideInfo(1, 1, 1, 1)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 310 | .set_name(param_path + "/Branch_2/Conv2d_0b_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 311 | << BatchNormalizationLayer( |
| 312 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_BatchNorm_moving_mean.npy"), |
| 313 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 314 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 315 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 316 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 317 | .set_name(param_path + "/Branch_2/Conv2d_0b_3x3/BatchNorm/batchnorm") |
| 318 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0b_3x3/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 319 | << ConvolutionLayer( |
| 320 | 3U, 3U, std::get<2>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 321 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 322 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 323 | PadStrideInfo(1, 1, 1, 1)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 324 | .set_name(param_path + "/Branch_2/Conv2d_0c_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 325 | << BatchNormalizationLayer( |
| 326 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_3x3_BatchNorm_moving_mean.npy"), |
| 327 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 328 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 329 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 330 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 331 | .set_name(param_path + "/Branch_2/Conv2d_0c_3x3/BatchNorm/batcnorm") |
| 332 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0c_3x3/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 333 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 334 | SubStream i_d(graph); |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 335 | i_d << PoolingLayer(PoolingLayerInfo(PoolingType::AVG, 3, common_params.data_layout, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL), |
| 336 | true)) |
| 337 | .set_name(param_path + "/Branch_3/AvgPool_0a_3x3/AvgPool") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 338 | << ConvolutionLayer( |
| 339 | 1U, 1U, d_filt, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 340 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 341 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 342 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 343 | .set_name(param_path + "/Branch_3/Conv2d_0b_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 344 | << BatchNormalizationLayer( |
| 345 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_moving_mean.npy"), |
| 346 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 347 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 348 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 349 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 350 | .set_name(param_path + "/Branch_3/Conv2d_0b_1x1/BatchNorm/batchnorm") |
| 351 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_3/Conv2d_0b_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 352 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 353 | return ConcatLayer(std::move(i_a), std::move(i_b), std::move(i_c), std::move(i_d)); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 354 | } |
| 355 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 356 | ConcatLayer get_inception_node_B(const std::string &data_path, std::string &¶m_path, DataLayout weights_layout, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 357 | unsigned int a_filt, |
| 358 | std::tuple<unsigned int, unsigned int, unsigned int> b_filters) |
| 359 | { |
| 360 | std::string total_path = "/cnn_data/inceptionv3_model/" + param_path + "_"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 361 | SubStream i_a(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 362 | i_a << ConvolutionLayer( |
| 363 | 3U, 3U, a_filt, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 364 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 365 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 366 | PadStrideInfo(2, 2, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 367 | .set_name(param_path + "/Branch_0/Conv2d_1a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 368 | << BatchNormalizationLayer( |
| 369 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_1x1_BatchNorm_moving_mean.npy"), |
| 370 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 371 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 372 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 373 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 374 | .set_name(param_path + "/Branch_0/Conv2d_1a_1x1/BatchNorm/batchnorm") |
| 375 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_0/Conv2d_1a_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 376 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 377 | SubStream i_b(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 378 | i_b << ConvolutionLayer( |
| 379 | 1U, 1U, std::get<0>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 380 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 381 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 382 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 383 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 384 | << BatchNormalizationLayer( |
| 385 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 386 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 387 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 388 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 389 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 390 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 391 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0a_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 392 | << ConvolutionLayer( |
| 393 | 3U, 3U, std::get<1>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 394 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 395 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 396 | PadStrideInfo(1, 1, 1, 1)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 397 | .set_name(param_path + "/Branch_1/Conv2d_0b_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 398 | << BatchNormalizationLayer( |
| 399 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_3x3_BatchNorm_moving_mean.npy"), |
| 400 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 401 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 402 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 403 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 404 | .set_name(param_path + "/Branch_1/Conv2d_0b_3x3/BatchNorm/batchnorm") |
| 405 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0b_3x3/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 406 | << ConvolutionLayer( |
| 407 | 3U, 3U, std::get<2>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 408 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 409 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 410 | PadStrideInfo(2, 2, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 411 | .set_name(param_path + "/Branch_1/Conv2d_1a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 412 | << BatchNormalizationLayer( |
| 413 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_1x1_BatchNorm_moving_mean.npy"), |
| 414 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 415 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 416 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 417 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 418 | .set_name(param_path + "/Branch_1/Conv2d_1a_1x1/BatchNorm/batchnorm") |
| 419 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_1a_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 420 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 421 | SubStream i_c(graph); |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 422 | i_c << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, common_params.data_layout, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))).set_name(param_path + "/Branch_2/MaxPool_1a_3x3/MaxPool"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 423 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 424 | return ConcatLayer(std::move(i_a), std::move(i_b), std::move(i_c)); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 425 | } |
| 426 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 427 | ConcatLayer get_inception_node_C(const std::string &data_path, std::string &¶m_path, DataLayout weights_layout, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 428 | unsigned int a_filt, |
| 429 | std::tuple<unsigned int, unsigned int, unsigned int> b_filters, |
| 430 | std::tuple<unsigned int, unsigned int, unsigned int, unsigned int, unsigned int> c_filters, |
| 431 | unsigned int d_filt) |
| 432 | { |
| 433 | std::string total_path = "/cnn_data/inceptionv3_model/" + param_path + "_"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 434 | SubStream i_a(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 435 | i_a << ConvolutionLayer( |
| 436 | 1U, 1U, a_filt, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 437 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 438 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 439 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 440 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 441 | << BatchNormalizationLayer( |
| 442 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 443 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 444 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 445 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 446 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 447 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 448 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_0/Conv2d_0a_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 449 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 450 | SubStream i_b(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 451 | i_b << ConvolutionLayer( |
| 452 | 1U, 1U, std::get<0>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 453 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 454 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 455 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 456 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 457 | << BatchNormalizationLayer( |
| 458 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 459 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 460 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 461 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 462 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 463 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 464 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0a_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 465 | << ConvolutionLayer( |
| 466 | 7U, 1U, std::get<1>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 467 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 468 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 469 | PadStrideInfo(1, 1, 3, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 470 | .set_name(param_path + "/Branch_1/Conv2d_0b_1x7/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 471 | << BatchNormalizationLayer( |
| 472 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_BatchNorm_moving_mean.npy"), |
| 473 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 474 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 475 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 476 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 477 | .set_name(param_path + "/Branch_1/Conv2d_0b_1x7/BatchNorm/batchnorm") |
| 478 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0b_1x7/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 479 | << ConvolutionLayer( |
| 480 | 1U, 7U, std::get<2>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 481 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 482 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 483 | PadStrideInfo(1, 1, 0, 3)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 484 | .set_name(param_path + "/Branch_1/Conv2d_0c_7x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 485 | << BatchNormalizationLayer( |
| 486 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_BatchNorm_moving_mean.npy"), |
| 487 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 488 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 489 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 490 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 491 | .set_name(param_path + "/Branch_1/Conv2d_0c_7x1/BatchNorm/batchnorm") |
| 492 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_0/Conv2d_0c_7x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 493 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 494 | SubStream i_c(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 495 | i_c << ConvolutionLayer( |
| 496 | 1U, 1U, std::get<0>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 497 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 498 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 499 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 500 | .set_name(param_path + "/Branch_2/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 501 | << BatchNormalizationLayer( |
| 502 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 503 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 504 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 505 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 506 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 507 | .set_name(param_path + "/Branch_2/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 508 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0a_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 509 | << ConvolutionLayer( |
| 510 | 1U, 7U, std::get<1>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 511 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_7x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 512 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 513 | PadStrideInfo(1, 1, 0, 3)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 514 | .set_name(param_path + "/Branch_2/Conv2d_0b_7x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 515 | << BatchNormalizationLayer( |
| 516 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_7x1_BatchNorm_moving_mean.npy"), |
| 517 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_7x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 518 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 519 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_7x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 520 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 521 | .set_name(param_path + "/Branch_2/Conv2d_0b_7x1/BatchNorm/batchnorm") |
| 522 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0b_7x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 523 | << ConvolutionLayer( |
| 524 | 7U, 1U, std::get<2>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 525 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x7_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 526 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 527 | PadStrideInfo(1, 1, 3, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 528 | .set_name(param_path + "/Branch_2/Conv2d_0c_1x7/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 529 | << BatchNormalizationLayer( |
| 530 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x7_BatchNorm_moving_mean.npy"), |
| 531 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x7_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 532 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 533 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x7_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 534 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 535 | .set_name(param_path + "/Branch_2/Conv2d_0c_1x7/BatchNorm/batchnorm") |
| 536 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0c_1x7/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 537 | << ConvolutionLayer( |
| 538 | 1U, 7U, std::get<3>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 539 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_7x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 540 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 541 | PadStrideInfo(1, 1, 0, 3)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 542 | .set_name(param_path + "/Branch_2/Conv2d_0d_7x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 543 | << BatchNormalizationLayer( |
| 544 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_7x1_BatchNorm_moving_mean.npy"), |
| 545 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_7x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 546 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 547 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_7x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 548 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 549 | .set_name(param_path + "/Branch_2/Conv2d_0d_7x1/BatchNorm/batchnorm") |
| 550 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0d_7x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 551 | << ConvolutionLayer( |
| 552 | 7U, 1U, std::get<4>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 553 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0e_1x7_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 554 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 555 | PadStrideInfo(1, 1, 3, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 556 | .set_name(param_path + "/Branch_2/Conv2d_0e_1x7/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 557 | << BatchNormalizationLayer( |
| 558 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0e_1x7_BatchNorm_moving_mean.npy"), |
| 559 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0e_1x7_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 560 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 561 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0e_1x7_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 562 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 563 | .set_name(param_path + "/Branch_2/Conv2d_0e_1x7/BatchNorm/batchnorm") |
| 564 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0e_1x7/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 565 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 566 | SubStream i_d(graph); |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 567 | i_d << PoolingLayer(PoolingLayerInfo(PoolingType::AVG, 3, common_params.data_layout, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL), |
| 568 | true)) |
| 569 | .set_name(param_path + "/Branch_3/AvgPool_0a_3x3/AvgPool") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 570 | << ConvolutionLayer( |
| 571 | 1U, 1U, d_filt, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 572 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 573 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 574 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 575 | .set_name(param_path + "/Branch_3/Conv2d_0b_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 576 | << BatchNormalizationLayer( |
| 577 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_moving_mean.npy"), |
| 578 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 579 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 580 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 581 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 582 | .set_name(param_path + "/Branch_3/Conv2d_0b_1x1/BatchNorm/batchnorm") |
| 583 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_3/Conv2d_0b_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 584 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 585 | return ConcatLayer(std::move(i_a), std::move(i_b), std::move(i_c), std::move(i_d)); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 586 | } |
| 587 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 588 | ConcatLayer get_inception_node_D(const std::string &data_path, std::string &¶m_path, DataLayout weights_layout, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 589 | std::tuple<unsigned int, unsigned int> a_filters, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 590 | std::tuple<unsigned int, unsigned int, unsigned int, unsigned int> b_filters) |
| 591 | { |
| 592 | std::string total_path = "/cnn_data/inceptionv3_model/" + param_path + "_"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 593 | SubStream i_a(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 594 | i_a << ConvolutionLayer( |
| 595 | 1U, 1U, std::get<0>(a_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 596 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 597 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 598 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 599 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 600 | << BatchNormalizationLayer( |
| 601 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 602 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 603 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 604 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 605 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 606 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 607 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_0/Conv2d_0a_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 608 | << ConvolutionLayer( |
| 609 | 3U, 3U, std::get<1>(a_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 610 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 611 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 612 | PadStrideInfo(2, 2, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 613 | .set_name(param_path + "/Branch_0/Conv2d_1a_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 614 | << BatchNormalizationLayer( |
| 615 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_3x3_BatchNorm_moving_mean.npy"), |
| 616 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 617 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 618 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_1a_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 619 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 620 | .set_name(param_path + "/Branch_0/Conv2d_1a_3x3/BatchNorm/batchnorm") |
| 621 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_0/Conv2d_1a_3x3/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 622 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 623 | SubStream i_b(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 624 | i_b << ConvolutionLayer( |
| 625 | 1U, 1U, std::get<0>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 626 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 627 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 628 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 629 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 630 | << BatchNormalizationLayer( |
| 631 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 632 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 633 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 634 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 635 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 636 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 637 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0a_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 638 | << ConvolutionLayer( |
| 639 | 7U, 1U, std::get<1>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 640 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 641 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 642 | PadStrideInfo(1, 1, 3, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 643 | .set_name(param_path + "/Branch_1/Conv2d_0b_1x7/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 644 | << BatchNormalizationLayer( |
| 645 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_BatchNorm_moving_mean.npy"), |
| 646 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 647 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 648 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x7_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 649 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 650 | .set_name(param_path + "/Branch_1/Conv2d_0b_1x7/BatchNorm/batchnorm") |
| 651 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0b_1x7/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 652 | << ConvolutionLayer( |
| 653 | 1U, 7U, std::get<2>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 654 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 655 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 656 | PadStrideInfo(1, 1, 0, 3)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 657 | .set_name(param_path + "/Branch_1/Conv2d_0c_7x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 658 | << BatchNormalizationLayer( |
| 659 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_BatchNorm_moving_mean.npy"), |
| 660 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 661 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 662 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0c_7x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 663 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 664 | .set_name(param_path + "/Branch_1/Conv2d_0c_7x1/BatchNorm/batchnorm") |
| 665 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0c_7x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 666 | << ConvolutionLayer( |
| 667 | 3U, 3U, std::get<3>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 668 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 669 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 670 | PadStrideInfo(2, 2, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 671 | .set_name(param_path + "/Branch_1/Conv2d_1a_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 672 | << BatchNormalizationLayer( |
| 673 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_3x3_BatchNorm_moving_mean.npy"), |
| 674 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 675 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 676 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_1a_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 677 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 678 | .set_name(param_path + "/Branch_1/Conv2d_1a_3x3/BatchNorm/batchnorm") |
| 679 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_1a_3x3/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 680 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 681 | SubStream i_c(graph); |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 682 | i_c << PoolingLayer(PoolingLayerInfo(PoolingType::MAX, 3, common_params.data_layout, PadStrideInfo(2, 2, 0, 0, DimensionRoundingType::CEIL))).set_name(param_path + "/Branch_2/MaxPool_1a_3x3/MaxPool"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 683 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 684 | return ConcatLayer(std::move(i_a), std::move(i_b), std::move(i_c)); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 685 | } |
| 686 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 687 | ConcatLayer get_inception_node_E(const std::string &data_path, std::string &¶m_path, DataLayout weights_layout, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 688 | unsigned int a_filt, |
| 689 | std::tuple<unsigned int, unsigned int, unsigned int> b_filters, |
| 690 | std::tuple<unsigned int, unsigned int, unsigned int, unsigned int> c_filters, |
| 691 | unsigned int d_filt, |
| 692 | bool is_name_different = false) |
| 693 | { |
| 694 | // This is due to a naming issue in the tf model |
| 695 | std::string conv_id = "_0b_"; |
| 696 | if(is_name_different) |
| 697 | { |
| 698 | conv_id = "_0c_"; |
| 699 | } |
| 700 | |
| 701 | std::string total_path = "/cnn_data/inceptionv3_model/" + param_path + "_"; |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 702 | SubStream i_a(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 703 | i_a << ConvolutionLayer( |
| 704 | 1U, 1U, a_filt, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 705 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 706 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 707 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 708 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 709 | << BatchNormalizationLayer( |
| 710 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 711 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 712 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 713 | get_weights_accessor(data_path, total_path + "Branch_0_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 714 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 715 | .set_name(param_path + "/Branch_0/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 716 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_0/Conv2d_0a_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 717 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 718 | SubStream i_b(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 719 | i_b << ConvolutionLayer( |
| 720 | 1U, 1U, std::get<0>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 721 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 722 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 723 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 724 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 725 | << BatchNormalizationLayer( |
| 726 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 727 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 728 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 729 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 730 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 731 | .set_name(param_path + "/Branch_1/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 732 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0a_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 733 | |
Georgios Pinitas | 772e17f | 2018-07-13 12:25:33 +0100 | [diff] [blame] | 734 | SubStream i_b1(i_b); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 735 | i_b1 << ConvolutionLayer( |
| 736 | 3U, 1U, std::get<1>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 737 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 738 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 739 | PadStrideInfo(1, 1, 1, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 740 | .set_name(param_path + "/Branch_1/Conv2d_0b_1x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 741 | << BatchNormalizationLayer( |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 742 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x3_BatchNorm_moving_mean.npy"), |
| 743 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 744 | nullptr, |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 745 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d_0b_1x3_BatchNorm_beta.npy"), |
| 746 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 747 | .set_name(param_path + "/Branch_1/Conv2d_0b_1x3/BatchNorm/batchnorm") |
| 748 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d_0b_1x3/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 749 | |
Georgios Pinitas | 772e17f | 2018-07-13 12:25:33 +0100 | [diff] [blame] | 750 | SubStream i_b2(i_b); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 751 | i_b2 << ConvolutionLayer( |
| 752 | 1U, 3U, std::get<2>(b_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 753 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id + "3x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 754 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 755 | PadStrideInfo(1, 1, 0, 1)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 756 | .set_name(param_path + "/Branch_1/Conv2d" + conv_id + "3x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 757 | << BatchNormalizationLayer( |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 758 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id + "3x1_BatchNorm_moving_mean.npy"), |
| 759 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id + "3x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 760 | nullptr, |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 761 | get_weights_accessor(data_path, total_path + "Branch_1_Conv2d" + conv_id + "3x1_BatchNorm_beta.npy"), |
| 762 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 763 | .set_name(param_path + "/Branch_1/Conv2d" + conv_id + "3x1/BatchNorm/batchnorm") |
| 764 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_1/Conv2d" + conv_id + "3x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 765 | |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 766 | // Merge b1 and b2 |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 767 | i_b << ConcatLayer(std::move(i_b1), std::move(i_b2)).set_name(param_path + "/Branch_1/concat"); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 768 | |
| 769 | SubStream i_c(graph); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 770 | i_c << ConvolutionLayer( |
| 771 | 1U, 1U, std::get<0>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 772 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 773 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 774 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 775 | .set_name(param_path + "/Branch_2/Conv2d_0a_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 776 | << BatchNormalizationLayer( |
| 777 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_moving_mean.npy"), |
| 778 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 779 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 780 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0a_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 781 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 782 | .set_name(param_path + "/Branch_2/Conv2d_0a_1x1/BatchNorm/batchnorm") |
| 783 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0a_1x1/Relu") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 784 | << ConvolutionLayer( |
| 785 | 3U, 3U, std::get<1>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 786 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 787 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 788 | PadStrideInfo(1, 1, 1, 1)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 789 | .set_name(param_path + "/Branch_2/Conv2d_0b_3x3/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 790 | << BatchNormalizationLayer( |
| 791 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_BatchNorm_moving_mean.npy"), |
| 792 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 793 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 794 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0b_3x3_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 795 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 796 | .set_name(param_path + "/Branch_2/Conv2d_0b_3x3/BatchNorm/batchnorm") |
| 797 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0b_3x3/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 798 | |
Georgios Pinitas | 772e17f | 2018-07-13 12:25:33 +0100 | [diff] [blame] | 799 | SubStream i_c1(i_c); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 800 | i_c1 << ConvolutionLayer( |
| 801 | 3U, 1U, std::get<2>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 802 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x3_weights.npy", weights_layout), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 803 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 804 | PadStrideInfo(1, 1, 1, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 805 | .set_name(param_path + "/Branch_2/Conv2d_0c_1x3/convolution") |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 806 | << BatchNormalizationLayer( |
| 807 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x3_BatchNorm_moving_mean.npy"), |
| 808 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x3_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 809 | nullptr, |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 810 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0c_1x3_BatchNorm_beta.npy"), |
| 811 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 812 | .set_name(param_path + "/Branch_2/Conv2d_0c_1x3/BatchNorm/batchnorm") |
| 813 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0c_1x3/Relu"); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 814 | |
Georgios Pinitas | 772e17f | 2018-07-13 12:25:33 +0100 | [diff] [blame] | 815 | SubStream i_c2(i_c); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 816 | i_c2 << ConvolutionLayer( |
| 817 | 1U, 3U, std::get<3>(c_filters), |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 818 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_3x1_weights.npy", weights_layout), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 819 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 820 | PadStrideInfo(1, 1, 0, 1)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 821 | .set_name(param_path + "/Branch_2/Conv2d_0d_3x1/convolution") |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 822 | << BatchNormalizationLayer( |
| 823 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_3x1_BatchNorm_moving_mean.npy"), |
| 824 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_3x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 825 | nullptr, |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 826 | get_weights_accessor(data_path, total_path + "Branch_2_Conv2d_0d_3x1_BatchNorm_beta.npy"), |
| 827 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 828 | .set_name(param_path + "/Branch_2/Conv2d_0d_3x1/BatchNorm/batchnorm") |
| 829 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_2/Conv2d_0d_3x1/Relu"); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 830 | |
| 831 | // Merge i_c1 and i_c2 |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 832 | i_c << ConcatLayer(std::move(i_c1), std::move(i_c2)).set_name(param_path + "/Branch_2/concat"); |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 833 | |
| 834 | SubStream i_d(graph); |
Sang-Hoon Park | 11fedda | 2020-01-15 14:44:04 +0000 | [diff] [blame] | 835 | i_d << PoolingLayer(PoolingLayerInfo(PoolingType::AVG, 3, common_params.data_layout, PadStrideInfo(1, 1, 1, 1, DimensionRoundingType::CEIL), |
| 836 | true)) |
| 837 | .set_name(param_path + "/Branch_3/AvgPool_0a_3x3/AvgPool") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 838 | << ConvolutionLayer( |
| 839 | 1U, 1U, d_filt, |
Georgios Pinitas | e222055 | 2018-07-20 13:23:44 +0100 | [diff] [blame] | 840 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_weights.npy", weights_layout), |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 841 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), |
| 842 | PadStrideInfo(1, 1, 0, 0)) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 843 | .set_name(param_path + "/Branch_3/Conv2d_0b_1x1/convolution") |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 844 | << BatchNormalizationLayer( |
| 845 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_moving_mean.npy"), |
| 846 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_moving_variance.npy"), |
giuros01 | 351bd13 | 2019-08-23 14:27:30 +0100 | [diff] [blame] | 847 | nullptr, |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 848 | get_weights_accessor(data_path, total_path + "Branch_3_Conv2d_0b_1x1_BatchNorm_beta.npy"), |
Georgios Pinitas | d8734b5 | 2017-12-22 15:27:52 +0000 | [diff] [blame] | 849 | 0.001f) |
Georgios Pinitas | 130986a | 2018-05-14 19:25:37 +0100 | [diff] [blame] | 850 | .set_name(param_path + "/Branch_3/Conv2d_0b_1x1/BatchNorm/batchnorm") |
| 851 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)).set_name(param_path + "/Branch_3/Conv2d_0b_1x1/Relu"); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 852 | |
Georgios Pinitas | 427bbbf | 2018-08-28 13:32:02 +0100 | [diff] [blame] | 853 | return ConcatLayer(std::move(i_a), std::move(i_b), std::move(i_c), std::move(i_d)); |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 854 | } |
| 855 | }; |
| 856 | |
| 857 | /** Main program for Inception V3 |
| 858 | * |
Georgios Pinitas | bdbbbe8 | 2018-11-07 16:06:47 +0000 | [diff] [blame] | 859 | * Model is based on: |
| 860 | * https://arxiv.org/abs/1512.00567 |
| 861 | * "Rethinking the Inception Architecture for Computer Vision" |
| 862 | * Christian Szegedy, Vincent Vanhoucke, Sergey Ioffe, Jonathon Shlens, Zbigniew Wojna |
| 863 | * |
Georgios Pinitas | 588ebc5 | 2018-12-21 13:39:07 +0000 | [diff] [blame] | 864 | * Provenance: download.tensorflow.org/models/inception_v3_2016_08_28.tar.gz |
| 865 | * |
Georgios Pinitas | 9f28b39 | 2018-07-18 20:01:53 +0100 | [diff] [blame] | 866 | * @note To list all the possible arguments execute the binary appended with the --help option |
| 867 | * |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 868 | * @param[in] argc Number of arguments |
Georgios Pinitas | 12be7ab | 2018-07-03 12:06:23 +0100 | [diff] [blame] | 869 | * @param[in] argv Arguments |
Georgios Pinitas | 652bde5 | 2018-01-10 15:33:28 +0000 | [diff] [blame] | 870 | */ |
| 871 | int main(int argc, char **argv) |
| 872 | { |
| 873 | return arm_compute::utils::run_example<InceptionV3Example>(argc, argv); |
| 874 | } |