C++ TensorFlow图像识别输出格式c++;

C++ TensorFlow图像识别输出格式c++;,c++,tensorflow,C++,Tensorflow,我使用tensorflow进行图像识别,通过以下命令: bazel bin/tensorflow/examples/label_image/label_image 终端中的当前输出格式为: 2017-04-19:I tensorflow/../main.cc:206]军服(653):0.834307 2017-04-19:I tensorflow/../main.cc:206]灰泥板(668):0.0218693 2017-04-19:I tensorflow/../main.cc:206]学术

我使用tensorflow进行图像识别,通过以下命令:

bazel bin/tensorflow/examples/label_image/label_image

终端中的当前输出格式为:

2017-04-19:I tensorflow/../main.cc:206]军服(653):0.834307

2017-04-19:I tensorflow/../main.cc:206]灰泥板(668):0.0218693

2017-04-19:I tensorflow/../main.cc:206]学术礼服(401):0.010358

2017-04-19:I tensorflow/../main.cc:206]pickelhaube(716):0.00809

2017-04-19:I tensorflow/../main.cc:206]防弹背心(466):0.00535086

输出函数为:

// this prints out the top five highest-scoring values.
Status PrintTopLabels(const std::vector<Tensor>& outputs,
                      string labels_file_name) {
  std::vector<string> labels;
  size_t label_count;
  Status read_labels_status =
      ReadLabelsFile(labels_file_name, &labels, &label_count);
  if (!read_labels_status.ok()) {
    LOG(ERROR) << read_labels_status;
    return read_labels_status;
  }
  const int how_many_labels = std::min(5, static_cast<int>(label_count));
  Tensor indices;
  Tensor scores;
  TF_RETURN_IF_ERROR(GetTopLabels(outputs, how_many_labels, &indices, &scores));
  tensorflow::TTypes<float>::Flat scores_flat = scores.flat<float>();
  tensorflow::TTypes<int32>::Flat indices_flat = indices.flat<int32>();
  for (int pos = 0; pos < how_many_labels; ++pos) {
    const int label_index = indices_flat(pos);
    const float score = scores_flat(pos);
    LOG(INFO) << labels[label_index] << " (" << label_index << "): " << score;
  }
  return Status::OK();
}
//这会打印出得分最高的前五名。
状态PrintTopLabels(常量标准::向量和输出,
字符串标签(文件名){
std::向量标签;
尺寸标签数量;
状态读取\u标签\u状态=
ReadLabelsFile(标签、文件名、标签和标签计数);
如果(!read\u labels\u status.ok()){

日志(错误)是的,我认为这是可能的。替换:

LOG(INFO) << labels[label_index] << " (" << label_index << "): " << score;

LOG(INFO)执行这个命令有什么困难吗?:bazel build tensorflow/examples/label\u image/。。。
std::cout << label[label_index] << ",";