| 43 | { |
| 44 | } |
| 45 | bool do_setup(int argc, char **argv) override |
| 46 | { |
| 47 | // Parse arguments |
| 48 | cmd_parser.parse(argc, argv); |
| 49 | cmd_parser.validate(); |
| 50 | |
| 51 | // Consume common parameters |
| 52 | common_params = consume_common_graph_parameters(common_opts); |
| 53 | |
| 54 | // Return when help menu is requested |
| 55 | if (common_params.help) |
| 56 | { |
| 57 | cmd_parser.print_help(argv[0]); |
| 58 | return false; |
| 59 | } |
| 60 | |
| 61 | // Print parameter values |
| 62 | std::cout << common_params << std::endl; |
| 63 | |
| 64 | // Get trainable parameters data path |
| 65 | std::string data_path = common_params.data_path; |
| 66 | |
| 67 | // Create a preprocessor object |
| 68 | std::unique_ptr<IPreprocessor> preprocessor = std::make_unique<TFPreproccessor>(); |
| 69 | |
| 70 | // Create input descriptor |
| 71 | const auto operation_layout = common_params.data_layout; |
| 72 | const TensorShape tensor_shape = |
| 73 | permute_shape(TensorShape(299U, 299U, 3U, common_params.batches), DataLayout::NCHW, operation_layout); |
| 74 | TensorDescriptor input_descriptor = |
| 75 | TensorDescriptor(tensor_shape, common_params.data_type).set_layout(operation_layout); |
| 76 | |
| 77 | // Set weights trained layout |
| 78 | const DataLayout weights_layout = DataLayout::NCHW; |
| 79 | |
| 80 | graph << common_params.target << common_params.fast_math_hint |
| 81 | << InputLayer(input_descriptor, get_input_accessor(common_params, std::move(preprocessor), false)) |
| 82 | // Conv2d_1a_3x3 |
| 83 | << ConvolutionLayer( |
| 84 | 3U, 3U, 32U, |
| 85 | get_weights_accessor(data_path, "/cnn_data/inceptionv4_model/Conv2d_1a_3x3_weights.npy", |
| 86 | weights_layout), |
| 87 | std::unique_ptr<arm_compute::graph::ITensorAccessor>(nullptr), PadStrideInfo(2, 2, 0, 0)) |
| 88 | .set_name("Conv2d_1a_3x3/Conv2D") |
| 89 | << BatchNormalizationLayer( |
| 90 | get_weights_accessor(data_path, |
| 91 | "/cnn_data/inceptionv4_model/Conv2d_1a_3x3_BatchNorm_moving_mean.npy"), |
| 92 | get_weights_accessor(data_path, |
| 93 | "/cnn_data/inceptionv4_model/Conv2d_1a_3x3_BatchNorm_moving_variance.npy"), |
| 94 | get_random_accessor(1.f, 1.f), |
| 95 | get_weights_accessor(data_path, "/cnn_data/inceptionv4_model/Conv2d_1a_3x3_BatchNorm_beta.npy"), |
| 96 | 0.001f) |
| 97 | .set_name("Conv2d_1a_3x3/BatchNorm") |
| 98 | << ActivationLayer(ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)) |
| 99 | .set_name("Conv2d_1a_3x3/Relu") |
| 100 | // Conv2d_2a_3x3 |
| 101 | << ConvolutionLayer( |
| 102 | 3U, 3U, 32U, |
nothing calls this directly
no test coverage detected