ncs.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Intel Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef MOVIDIUS_NCS_LIB_NCS_H
18 #define MOVIDIUS_NCS_LIB_NCS_H
19 
20 #include <vector>
21 #include <string>
22 #include <opencv2/opencv.hpp>
23 #include <ros/ros.h>
24 
26 #include "movidius_ncs_lib/graph.h"
28 
29 namespace movidius_ncs_lib
30 {
31 class NCS
32 {
33 public:
34  NCS(int device_index,
35  Device::LogLevel log_level,
36  const std::string& cnn_type,
37  const std::string& graph_file_path,
38  const std::string& category_file_path,
39  const int network_dimension,
40  const std::vector<float>& mean,
41  const float& scale,
42  const int& top_n);
43  ~NCS();
44 
45  void classify();
46  void detect();
47  void loadTensor(const cv::Mat& image);
50 
51 private:
52  void initDevice();
53  void loadGraph(const std::string& graph_file_path);
54  void loadCategories(const std::string& category_file_path);
55  static void splitIntoLines(const std::string& content,
56  std::vector<std::string>& lines);
57  static std::string getFileContent(const std::string& filename);
58 
63 
64  const int device_index_;
66  const std::string cnn_type_;
67  std::vector<std::string> categories_;
68  const int network_dimension_;
69  const std::vector<float> mean_;
70  const float scale_;
71  const int top_n_;
72  void* user_param_;
73 };
74 } // namespace movidius_ncs_lib
75 #endif // MOVIDIUS_NCS_LIB_NCS_H
std::shared_ptr< Result > Ptr
Definition: result.h:70
const std::string cnn_type_
Definition: ncs.h:66
std::shared_ptr< Graph > Ptr
Definition: graph.h:35
const int top_n_
Definition: ncs.h:71
std::shared_ptr< DetectionResult > DetectionResultPtr
Definition: result.h:64
const std::vector< float > mean_
Definition: ncs.h:69
Tensor::Ptr tensor_
Definition: ncs.h:61
void loadGraph(const std::string &graph_file_path)
Definition: ncs.cpp:213
void loadCategories(const std::string &category_file_path)
Definition: ncs.cpp:221
Graph::Ptr graph_
Definition: ncs.h:60
static std::string getFileContent(const std::string &filename)
Definition: ncs.cpp:253
std::shared_ptr< Tensor > Ptr
Definition: tensor.h:32
const float scale_
Definition: ncs.h:70
DetectionResultPtr getDetectionResult()
Definition: ncs.cpp:202
const int device_index_
Definition: ncs.h:64
std::shared_ptr< Device > Ptr
Definition: device.h:29
static void splitIntoLines(const std::string &content, std::vector< std::string > &lines)
Definition: ncs.cpp:241
Result::Ptr result_
Definition: ncs.h:62
std::vector< std::string > categories_
Definition: ncs.h:67
NCS(int device_index, Device::LogLevel log_level, const std::string &cnn_type, const std::string &graph_file_path, const std::string &category_file_path, const int network_dimension, const std::vector< float > &mean, const float &scale, const int &top_n)
Definition: ncs.cpp:34
std::shared_ptr< ClassificationResult > ClassificationResultPtr
Definition: result.h:63
Device::Ptr device_
Definition: ncs.h:59
const int network_dimension_
Definition: ncs.h:68
ClassificationResultPtr getClassificationResult()
Definition: ncs.cpp:197
void loadTensor(const cv::Mat &image)
Definition: ncs.cpp:184
void * user_param_
Definition: ncs.h:72
const Device::LogLevel log_level_
Definition: ncs.h:65


movidius_ncs_lib
Author(s): Xiaojun Huang
autogenerated on Mon Jun 10 2019 14:11:23