在Pycaffe中打印blob名称

时间:2017-03-27 05:51:40

标签: python caffe pycaffe

我可以用C ++打印blob名称,如下所示。

    for (int index = 0; index < net_->blobs().size(); ++index) //net_->layer_names().size()       
    {     
            const boost::shared_ptr<Blob<float> > blob = net_->blob_by_name(net_->blob_names()[index]);
            int batch_size = blob->num();            
            int dim_features = blob->count() / batch_size;
                std::cout << "Blob name:" << "'" <<net_->blob_names()[index] << "'" << " batch size " << "'" << batch_size << "'" << " channels:" << "'" << blob->channels() << "'" << " height:" << "'" << blob->height() <<  "'" << " width:" << "'" << blob->width() << "'" <<std::endl;
    }

我在python中寻找类似的api。 我只知道在python中打印图层名称,如何打印blob名称和大小?

This is for printing layer names
for layer_name, blob in net.blobs.iteritems():
        print layer_name + '\t' + str(blob.data.shape)

0 个答案:

没有答案