如何将caffemodel文件打印出来

2025-05-13 19:33:18
推荐回答(1个)
回答(1):

//1.先解析到message proto中
caffe::NetParameter proto;
int fd = open(filename, O_RDONLY);
FileInputStream* input = new FileInputStream(fd);
bool success = google::protobuf::TextFormat::Parse(input, proto);

//2.proto转化为string
std::string p;
google::protobuf::TextFormat::PrintToString(proto,&p);
--