Ubuntu14.04 + Text-Detection-with-FRCN(CPU)
操作系统:
yt@yt-MS-:~$ cat /etc/issue
Ubuntu 14.04. LTS \n \l
Python版本:
yt@yt-MS-:~$ python --version
Python 2.7.
pip版本:
yt@yt-MS-:~$ pip --version
pip 1.5. from /usr/lib/python2./dist-packages (python 2.7)
源文件:
git clone --recursive https://github.com/jugg1024/Text-Detection-with-FRCN.git
1. 安装Caffe需要的依赖包:
sudo apt-get install build-essential # basic requirement
sudo apt-get install libblas-dev libopenblas-base liblapack-devlibprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libboost-all-dev libhdf5-serial-dev libgflags-dev libgoogle-glog-dev liblmdb-dev protobuf-compiler #required by caffe
将caffe-fast-rcnn/python目录下的requirements下的依赖都装一遍:
cd Text-Detection-with-FRCN/py-faster-rcnn/caffe-fast-rcnn/python
cat requirements.txt for req in $(cat requirements.txt); do pip install $req; done
Cython>=0.19.
numpy>=1.7.
scipy>=0.13.
scikit-image>=0.9.
matplotlib>=1.3.
ipython>=3.0.
h5py>=2.2.
leveldb>=0.191
networkx>=1.8.
nose>=1.3.
pandas>=0.12.
python-dateutil>=1.4,<
protobuf>=2.5.
python-gflags>=2.0
pyyaml>=3.10
Pillow>=2.3.
six>=1.1.
这里有一个小技巧,因为pip这个工具对应的网络非常的烂,这个时候,可以将其改为国内的镜像网站,速度将提升几个数量级,方法如下:
sudo pip install ipython -i http://pypi.douban.com/simple
如果出现有依赖包安装失败可以使用这种形式安装
sudo apt-get install python-matplotlib
除此之外还有以下依赖包:
sudo pip install easydict
sudo pip install opencv_python
2. 编译
编译 py-faster-rcnn
2.1 change the branch of py-faster-rcnn to text-detection-demo.
cd Text-Detection-with-FRCN/py-faster-rcnn
git checkout text-detection
2.2 Build Caffe and pycaffe.
cd Text-Detection-with-FRCN/py-faster-rcnn/caffe-fast-rcnn
cp Makefile.config.example Makefile.config
修改 Makefile.config
CPU_ONLY :=
WITH_PYTHON_LAYER :=
# 以下可选择性改变 BLAS_INCLUDE := /usr/include/atlas-x86_64-base
BLAS_LIB := /usr/lib64/atlas PYTHON_INCLUDE := /usr/include/python2. \
/usr/lib64/python2./site-packages/numpy/core/include PYTHON_LIB := /usr/lib64 # Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/include
LIBRARY_DIRS := $(PYTHON_LIB) /usr/lib64
编译(也可以直接 make , make pycaffe )
make -j16 && make pycaffe # here only python api is used.
测试下
cd python
python
>>> import caffe
>>> caffe.__version__
'1.0.0-rc3'
2.2 Build the Cython modules.
cd Text-Detection-with-FRCN/py-faster-rcnn/lib
修改 setup.py 把所以关于gpu的部分注释掉
# CUDA = locate_cuda()
# self.set_executable('compiler_so', CUDA['nvcc'])
# Extension('nms.gpu_nms',
# ['nms/nms_kernel.cu', 'nms/gpu_nms.pyx'],
# library_dirs=[CUDA['lib64']],
# libraries=['cudart'],
# language='c++',
# runtime_library_dirs=[CUDA['lib64']],
# # this syntax is specific to this build system
# # we're only going to use certain compiler args with nvcc and not with
# # gcc the implementation of this trick is in customize_compiler() below
# extra_compile_args={'gcc': ["-Wno-unused-function"],
# 'nvcc': ['-arch=sm_35',
# '--ptxas-options=-v',
# '-c',
# '--compiler-options',
# "'-fPIC'"]},
# include_dirs = [numpy_include, CUDA['include']]
# ),
修改 ./fast_rcnn/nms_wrapper.py
#from nms.gpu_nms import gpu_nms def nms(dets, thresh, force_cpu=True):
修改 ./fast_rcnn/config.py
__C.USE_GPU_NMS = False
修改 py-faster-rcnn/tools/test_net.py和 py-faster-rcnn/tools/train_net.py
将 caffe.set_mode_gpu()修改为caffe.set_mode_cpu().
编译
make
3. Run demo
- Run text detection demo
1. 下载训练好的模型,解压放到 Text-Detection-with-FRCN/models
URL: http://pan.baidu.com/s/1dE2Ori5 Extract Code: phxk2. run demo,检测结果会保存在Text-Detection-with-FRCN/output_img
cd Text-Detection-with-FRCN/
./script/text_detect_demo.sh3. training, if you think the model is not ok, then you can trainning with your own dataset, take coco-text for example.
3.1 download coco-text dataset
cd Text-Detection-with-FRCN/datasets/script
./fetch_dataset.sh coco-text
# download it takes long!
# ensure you have both data and label
# for coco-text label is in COCO-text.json, and data is in train2014.zip3.2 download pre-train model
# finetune on this model, you can also use one model you train before
cd Text-Detection-with-FRCN/py-faster-rcnn
./data/scripts/fetch_imagenet_models.sh
# download it takes long!3.3 format the data(you should write your code here)
# format the raw image and label into the type of pascal_voc
# follow the code in $Text-Detection-with-FRCN/datasets/script/format_annotation.py
cd Text-Detection-with-FRCN/datasets/script
./format_annotation.py --dataset coco-text3.4 create a softlink the formatted data to working directorry
# link your data folder to train_data
cd Text-Detection-with-FRCN/datasets/
ln -s train_data coco-text # $YOUR_DATA3.5 training
cd Text-Detection-with-FRCN/py-faster-rcnn/
./experiments/scripts/faster_rcnn_end2end.sh [gpu-id] [net](VGG16) [label_type](must be pascal_voc) - Run text detection demo
1. 下载训练好的模型,解压放到 Text-Detection-with-FRCN/py-faster-rcnn/data/faster_rcnn_modelscd Text-Detection-with-FRCN/py-faster-rcnn/data/scripts
./ fetch_faster_rcnn_models.sh2. 修改 demo.py, 添加保存输出语句
cd Text-Detection-with-FRCN/py-faster-rcnn/tools
def demo(net, image_name):
'''''' output_dir = os.path.join(cfg.ROOT_DIR, '..', 'output_img',
image_name.split('/')[-] + "_detect_rst.jpg")
plt.savefig(output_dir)3. run demo,检测结果会保存在Text-Detection-with-FRCN/output_img
cd Text-Detection-with-FRCN/py-faster-rcnn/tools
./demo.py --cpu
参考:
- http://www.cnblogs.com/justinzhang/p/5386837.html
- http://blog.sina.com.cn/s/blog_679f93560102wpyf.html
- http://blog.csdn.net/wuzuyu365/article/details/5189525
- http://blog.csdn.net/u011762313/article/details/47262549
Ubuntu14.04 + Text-Detection-with-FRCN(CPU)的更多相关文章
- Caffe初学者第一部:Ubuntu14.04上安装caffe(CPU)+Python的详细过程 (亲测成功, 20180524更新)
前言: 最近在学习深度学习,最先要解决的当然是开源框架的环境安装了.之前一直在学习谷歌的Tensorflow开源框架,最近实验中需要跟别人的算法比较,下载的别人的代码很多都是Caffe的,所以想着搭建 ...
- ubuntu14.04 编译安装CPU版caffe
本文,试图中一个干净的ubuntu14.04机器上安装caffe的cpu版本. http://blog.csdn.net/sinat_35188997/article/details/735304 ...
- ubuntu14.04下CPU的caffe配置,不成功的朋友请与我(lee)联系,后面附带邮箱
因广大朋友需求cpu的caffe配置.所以我(lee)在这份博客中对cpu配置caffe做出对应操作说明.希望能够解决大家对cpu配置caffe的困惑.少走弯路. 假设有安装不成功的朋友能够和我联系, ...
- Ubuntu14.04 caffe 配置
1.前置条件验证 (1) Ubuntu14.04操作系统. (2) 检验计算机是否为NVIDIA显卡,终端输入命令 $ lspci | grep -invidia (3) 检验计算机是否为x86_6 ...
- 【转】Linux(ubuntu14.04)上编译Android4.4源码的环境搭建及编译全过程
原文网址:http://jileniao.net/linux-android-building.html sublime text让我伤心.本来很信任sublime text的自动保存功能,之前使用一 ...
- ubuntu14.04+nvidia driver+cuda8+cudnn5+tensorflow0.12
文章在简书里面编辑的,复制过来貌似不太好看,还是到简书的页面看吧: http://www.jianshu.com/p/c89b97d052b7 1.安装环境简介: 硬件: cpu:i7 6700k g ...
- Ubuntu14.04安装wineqq国际版
一开始,我在Ubuntu14.04下安装的QQ版本是WineQQ2013SP6-20140102-Longene, 但后来发现这个版本QQ在linux下问题很多,比如不能用键盘输入密码,QQ表情 ...
- 论文阅读(Xiang Bai——【arXiv2016】Scene Text Detection via Holistic, Multi-Channel Prediction)
Xiang Bai--[arXiv2016]Scene Text Detection via Holistic, Multi-Channel Prediction 目录 作者和相关链接 方法概括 创新 ...
- Ubuntu14.04+Beanstalkd1.9最佳实践
目录 [TOC] 1.基本概念 1.1.什么是Beanstalkd? Beanstalkd 是一个轻量级消息中间件,它最大特点是将自己定位为基于管道 (tube) 和任务 (job) 的工作队列. ...
随机推荐
- 2018.11.05 bzoj3124: [Sdoi2013]直径(树形dp)
传送门 一道sbsbsb树形dpdpdp 第一问直接求树的直径. 考虑第二问问的边肯定在同一条直径上均是连续的. 因此我们将直径记下来. 然后对于直径上的每一个点,dpdpdp出以这个点为根的子树中不 ...
- yyparse() and yylex()
Yacc 与 Lex 快速入门 yyparse() returns a value of 0 if the input it parses is valid according to the give ...
- centos 7 安装 python3.6 python3 安装步骤以及pip pip3安装挂载
首先去python官网下载python3的源码包,网址:https://www.python.org/ 或者直接wget下载 wget https://www.python.org/ftp/pytho ...
- 安卓TP驱动开发
转自 blog.csdn.net/dddxxxx/article/details/54312415
- php 微信登录 公众号 获取用户信息 微信网页授权
php 微信登录 公众号 获取用户信息 微信网页授权 先自己建立两个文件: index.php 和 getUserInfo.php index.php <?php //scope=snsap ...
- nginx 下载 大文件被截断
如果出现大文件被截断,且ngix的日志大量出现以下类似报错: 则说明是nginx没有fastcgi_temp的读写权限.其中fastcgi_temp是自己的文件夹名称,每个人的不同且路径也会不同,这个 ...
- FPGA之初认识
什么是FPGA FPGA(Field-Programmable Gate Array),即现场可编程门阵列 .看到编程两个字码农就笑了,不就是编程嘛,那可是我们的强项 .且慢,此编程非彼编程 .一定要 ...
- 敏捷项目管理工具-Trello(电子看板)
Trello简介(https://www.trello.com) A Trello board is a list of lists, filled with cards, used by you a ...
- codeblocks+SDCC开发51单片机
说到51,大部分人都是用的是KEIL开发环境,但是KEIL是商业软件,我们一般人都用的是破解版的,如果用于商业就会收到法律诉讼.然而有一款很好的编译器专为51内核而存在.SDCC最大的有点就是开源免费 ...
- MySQL查询练习(45道)
题目:设有一数据库,包括四个表:学生表(Student).课程表(Course).成绩表(Score)以及教师信息表(Teacher). 四个表的结构分别如表1-1的表(一)~表(四)所示,数据如表1 ...