首页 文章

如何在c中获得图层的顶级标签?

提问于
浏览
1

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)我在哪里可以找到使用c来解释使用caffe框架的最常用API的教程或示例?

先感谢您 .

1 回答

  • 1

    看看doxygen中的Net类:

    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_ 接口访问各种名称/数据,只需阅读doc

相关问题