Takes a file name, and loads a list of labels from it, one per line, and returns a vector of the strings.
| 56 | // Takes a file name, and loads a list of labels from it, one per line, and |
| 57 | // returns a vector of the strings. |
| 58 | Status ReadLabelsFile(const string& file_name, std::vector<string>* result) { |
| 59 | std::ifstream file(file_name); |
| 60 | if (!file) { |
| 61 | return tensorflow::errors::NotFound("Labels file ", file_name, |
| 62 | " not found."); |
| 63 | } |
| 64 | result->clear(); |
| 65 | string line; |
| 66 | while (std::getline(file, line)) { |
| 67 | result->push_back(line); |
| 68 | } |
| 69 | return Status::OK(); |
| 70 | } |
| 71 | |
| 72 | // Analyzes the output of the graph to retrieve the highest scores and |
| 73 | // their positions in the tensor. |