如何在 C++ 中获取层的顶部标签?

How can I get layer's top label in c++?

1)是否可以在c++中获取每一层的顶层标签(例如:ip1、ip2、conv1、conv2)? 如果我的图层是

layer {
  name: "relu1_1"
  type: "Input"
  top: "pool1"
  input_param { 
      shape: { 
          dim:1 
          dim: 1 
          dim: 28 
          dim: 28 
          } 
     }
}

我想获得顶部标签,在我的例子中是“pool1

我搜索了提供的示例,但找不到任何内容。目前我只能通过以下命令获取图层名称和图层类型,

cout << "Layer name:" << "'" << net_->layer_names()[layer_index]<<endl;
cout << "Layer type: " << net_->layers()[layer_index]->type()<<endl;

2) 我在哪里可以找到解释最常用 API 使用 c++ 使用 caffe 框架的教程或示例?

提前谢谢你。

在 doxygen 中查看 Net class:

const vector< vector< Blob< Dtype > * > > all_ tops = net_->top_vecs();  // get "top" of all layers
Blob<Dtype>* ptop = all_tops[layer_index][0];  // pointer to top blob of layer

如果你想要图层的名称,你可以

const string layer_name = net_->layer_names()[layer_index];

您可以使用 net_ 界面访问各种 names/data,只需阅读 doc!