From 140fdc76e99c92b2f71865b679de0659a70b713f Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 16 Feb 2018 11:42:38 +0000 Subject: COMPMID-913: Fix preprocessing step for TF models. Change-Id: If0fbb6bbe5384038124d3dc189274b8266f796ca Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/120771 Reviewed-by: Anthony Barbier Reviewed-by: Pablo Tello Tested-by: Jenkins --- examples/graph_squeezenet_v1_1.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'examples/graph_squeezenet_v1_1.cpp') diff --git a/examples/graph_squeezenet_v1_1.cpp b/examples/graph_squeezenet_v1_1.cpp index 3c6be742fa..92a592390e 100644 --- a/examples/graph_squeezenet_v1_1.cpp +++ b/examples/graph_squeezenet_v1_1.cpp @@ -54,9 +54,9 @@ public: std::string image; /* Image data */ std::string label; /* Label data */ - constexpr float mean_r = 122.68f; /* Mean value to subtract from red channel */ - constexpr float mean_g = 116.67f; /* Mean value to subtract from green channel */ - constexpr float mean_b = 104.01f; /* Mean value to subtract from blue channel */ + // Create a preprocessor object + const std::array mean_rgb{ { 122.68f, 116.67f, 104.01f } }; + std::unique_ptr preprocessor = arm_compute::support::cpp14::make_unique(mean_rgb); // Set target. 0 (NEON), 1 (OpenCL), 2 (OpenCL with Tuner). By default it is NEON const int int_target_hint = argc > 1 ? std::strtol(argv[1], nullptr, 10) : 0; @@ -99,7 +99,7 @@ public: graph << target_hint << Tensor(TensorInfo(TensorShape(227U, 227U, 3U, 1U), 1, DataType::F32), - get_input_accessor(image, mean_r, mean_g, mean_b)) + get_input_accessor(image, std::move(preprocessor))) << ConvolutionLayer( 3U, 3U, 64U, get_weights_accessor(data_path, "/cnn_data/squeezenet_v1_1_model/conv1_w.npy"), -- cgit v1.2.1