Reads a model graph definition from disk, and creates a session object you can use to run it.
| 166 | // Reads a model graph definition from disk, and creates a session object you |
| 167 | // can use to run it. |
| 168 | Status LoadGraph(const string& graph_file_name, |
| 169 | std::unique_ptr<tensorflow::Session>* session) { |
| 170 | tensorflow::GraphDef graph_def; |
| 171 | Status load_graph_status = |
| 172 | ReadBinaryProto(tensorflow::Env::Default(), graph_file_name, &graph_def); |
| 173 | if (!load_graph_status.ok()) { |
| 174 | return tensorflow::errors::NotFound("Failed to load compute graph at '", |
| 175 | graph_file_name, "'"); |
| 176 | } |
| 177 | session->reset(tensorflow::NewSession(tensorflow::SessionOptions())); |
| 178 | Status session_create_status = (*session)->Create(graph_def); |
| 179 | if (!session_create_status.ok()) { |
| 180 | return session_create_status; |
| 181 | } |
| 182 | return Status::OK(); |
| 183 | } |
| 184 | |
| 185 | // Analyzes the output of the MultiBox graph to retrieve the highest scores and |
| 186 | // their positions in the tensor, which correspond to individual box detections. |
no test coverage detected