@@ -40,28 +40,30 @@ extern tf::Status LoadGraph(const string& graph_file_name,
4040 std::unique_ptr<tf::Session>* session,
4141 const tf::SessionOptions& options);
4242
43- extern tf::Status ReadTensorFromImageFile (const string& file_name ,
43+ extern tf::Status ReadTensorFromImageFile (const std::vector< string>& file_names ,
4444 const int input_height,
4545 const int input_width,
4646 const float input_mean,
4747 const float input_std, bool use_NCHW,
48+ const int input_channels,
4849 std::vector<tf::Tensor>* out_tensors);
4950
5051namespace infer_multiple_networks {
5152
5253InferenceEngine::InferenceEngine (const string& name, const string& backend)
5354 : m_name(name) {}
54- Status InferenceEngine::Load (const string& network, const string& image_file,
55+ Status InferenceEngine::Load (const string& network,
56+ const std::vector<string>& image_files,
5557 int input_width, int input_height,
5658 float input_mean, float input_std,
5759 const string& input_layer,
5860 const string& output_layer, bool use_NCHW,
59- bool preload_images) {
61+ bool preload_images, int input_channels ) {
6062 // Load the network
6163 TF_CHECK_OK (CreateSession (network, m_session));
6264
6365 // Save the input related information
64- m_image_file = image_file ;
66+ m_image_files = image_files ;
6567 m_input_width = input_width;
6668 m_input_height = input_height;
6769 m_input_mean = input_mean;
@@ -70,6 +72,7 @@ Status InferenceEngine::Load(const string& network, const string& image_file,
7072 m_output_layer = output_layer;
7173 m_use_NCHW = use_NCHW;
7274 m_preload_images = preload_images;
75+ m_input_channels = input_channels;
7376
7477 // Preload the image is requested
7578 if (m_preload_images) {
@@ -79,8 +82,8 @@ Status InferenceEngine::Load(const string& network, const string& image_file,
7982 tf::ngraph_bridge::BackendManager::SetBackendName (" CPU" );
8083 std::vector<tf::Tensor> resized_tensors;
8184 TF_CHECK_OK (ReadTensorFromImageFile (
82- m_image_file , m_input_height, m_input_width, m_input_mean, m_input_std,
83- m_use_NCHW, &resized_tensors));
85+ m_image_files , m_input_height, m_input_width, m_input_mean, m_input_std,
86+ m_use_NCHW, m_input_channels, &resized_tensors));
8487 m_image_to_repeat = resized_tensors[0 ];
8588 tf::ngraph_bridge::BackendManager::SetBackendName (current_backend);
8689 }
@@ -131,8 +134,8 @@ void InferenceEngine::ThreadMain() {
131134
132135 std::vector<tf::Tensor> resized_tensors;
133136 TF_CHECK_OK (ReadTensorFromImageFile (
134- m_image_file , m_input_height, m_input_width, m_input_mean,
135- m_input_std, m_use_NCHW, &resized_tensors));
137+ m_image_files , m_input_height, m_input_width, m_input_mean,
138+ m_input_std, m_use_NCHW, m_input_channels, &resized_tensors));
136139
137140 m_image_to_repeat = resized_tensors[0 ];
138141 tf::ngraph_bridge::BackendManager::SetBackendName (current_backend);
@@ -150,7 +153,6 @@ void InferenceEngine::ThreadMain() {
150153 std::vector<Tensor> outputs;
151154 TF_CHECK_OK (m_session->Run ({{m_input_layer, resized_tensor}},
152155 {m_output_layer}, {}, &outputs));
153-
154156 infer_event.Stop ();
155157
156158 ngraph::Event::write_trace (infer_event);
0 commit comments