caffe之SSD算法词袋解析
来源:互联网 发布:手动安装windows补丁 编辑:程序博客网 时间:2024/04/19 17:01
text解析接口函数:
https://developers.google.com/protocol-buffers/docs/reference/cpp/google.protobuf.text_format
代码如下:
#include "caffe/proto/caffe.pb.h"#include <caffe/caffe.hpp>#include <iostream>#include <fstream>#include <string>#include <fcntl.h>#include <google/protobuf/io/coded_stream.h> #include <google/protobuf/io/zero_copy_stream_impl.h> #include <google/protobuf/text_format.h> using namespace caffe;using namespace std;int main(int argc, char const *argv[]){ LabelMap labelmap; int fd = open(argv[1], O_RDONLY | 0); CHECK_NE(fd, -1) << "File not found: " << argv[1]; google::protobuf::io::FileInputStream fileInput(fd); fileInput.SetCloseOnDelete( true ); bool success = google::protobuf::TextFormat::Merge(&fileInput,&labelmap); for(int i = 0; i < labelmap.item_size(); i++) { const LabelMapItem& vociterm = labelmap.item(i); cout<< "Name:"<< vociterm.name() << endl; cout<<"label:"<< vociterm.label() << endl; cout<<"display_name:"<<vociterm.display_name()<< endl; } close(fd); return success;}
makefile文件如下:
CAFFEROOT=../../deeplearning/ssd/caffeCAFFEINC=-I$(CAFFEROOT)/include\ -I$(CAFFEROOT)/build/src\ -I/usr/local/Cellar/openblas/0.2.19_1/include\ -I./includeCAFFELIB=-L$(CAFFEROOT)/build/lib\ -L/usr/local/lib\ -lcaffe -lglog -lboost_system -lgflags -lprotobufCAFFEFLAGS=-D CPU_ONLYOPENCVINC=$(shell pkg-config opencv --cflags) OPENCVLIBS=$(shell pkg-config opencv --libs) SRC=parse_caffe_itermap.cppall: g++ -o parse_voc $(SRC) $(CAFFEFLAGS) $(CAFFELIB) $(CAFFEINC) $(OPENCVINC) $(OPENCVLIBS)clean: rm -rf parse_voc
阅读全文
0 0
- caffe之SSD算法词袋解析
- 对卷积层dilation膨胀的作用的理解,caffe-ssd dilation Hole算法解析
- caffe ssd
- caffe ssd
- 【SSD】SSD caffe编译不通过
- SSD算法特征map的计算和caffe代码理解
- SSD算法的改进版之R-SSD
- Caffe之WindowDataLayer 解析
- SSD caffe install
- Caffe-SSD 安装过程
- 编译SSD caffe出错
- caffe windows10 ssd配置
- caffe+SSD封装
- 配置caffe-SSD
- caffe ssd gpu
- caffe源码解析之blob
- [Caffe]源码解析之Layer
- Caffe学习之命令行解析
- ThinkPHP 的页面静态化功能的实现(二)
- java 搭建基于springboot的ssh(spring + springmvc + hibernate)的gradle项目(添加多Module篇)
- 有史以来程序员最实用快捷键
- 1064. Complete Binary Search Tree 解析
- 牛客网编程基础6-8
- caffe之SSD算法词袋解析
- ThinkPHP 的页面静态化功能的实现(一)
- Informatica的下载安装和配置
- PHP人性化时间显示,实现多少秒前,多少分钟前,多少小时前
- PHP判断手机设备访问
- PHP强制下载文件
- iOS 应用跳转到AppStore评分 可内置跳转
- PHP删除文件夹及文件夹下的所有文件
- MySQL 元数据