deep features for text spotting 在windows上使用
来源:互联网 发布:java归并排序算法 编辑:程序博客网 时间:2024/06/09 01:36
deep features for text spotting这篇文章中给的matlab代码eccv2014_textspotting,是作者在mac上编译好的,我们在Windows和linux下使用的时候需要自己编译mex文件。
下面主要介绍如何在Windows下只编译CPU的版本,即不需要GPU支持。
该matlab代码用的是Matconvnet这个是深度学习框架来做文本检测,故我们需要先去下载一个通用版本的 Matconvnet。
github下载地址如下:https://github.com/vlfeat/matconvnet
也可以在我上传在CSDN上下载:http://download.csdn.net/detail/hjl240/9470822
然后用他提供的matconvnet-master\matlab\vl_compilenn.m 进行编译,修改 vl_compilenn 这个文件里面 193行至233行的代码,原本是这样:
将193行至223行的代码
if opts.enableGpu, ext = 'cu' ; else ext='cpp' ; endlib_src{end+1} = fullfile(root,'matlab','src','bits',['data.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['datamex.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['nnconv.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['nnfullyconnected.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['nnsubsample.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['nnpooling.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['nnnormalize.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['nnbnorm.' ext]) ;lib_src{end+1} = fullfile(root,'matlab','src','bits',['nnbias.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['vl_nnconv.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['vl_nnconvt.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['vl_nnpool.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['vl_nnnormalize.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['vl_nnbnorm.' ext]) ; % CPU-specific fileslib_src{end+1} = fullfile(root,'matlab','src','bits','impl','im2row_cpu.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','subsample_cpu.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','copy_cpu.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','pooling_cpu.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','normalize_cpu.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','bnorm_cpu.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','tinythread.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','imread.cpp') ; % GPU-specific filesif opts.enableGpu lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','im2row_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','subsample_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','copy_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','pooling_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','normalize_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','impl','bnorm_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','datacu.cu') ;end
替换为如下代码:
if opts.enableGpu, ext = 'cu' ; else ext='cpp' ; endmex_src{end+1} = fullfile(root,'matlab','src',['gconv.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['gnormalize.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['gpool.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['gsepconv.' ext]) ;mex_src{end+1} = fullfile(root,'matlab','src',['gsepconv2.' ext]) % CPU-specific fileslib_src{end+1} = fullfile(root,'matlab','src','bits','im2col.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','pooling.cpp') ;lib_src{end+1} = fullfile(root,'matlab','src','bits','normalize.cpp') ; % GPU-specific filesif opts.enableGpu lib_src{end+1} = fullfile(root,'matlab','src','bits','im2col_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','pooling_gpu.cu') ; lib_src{end+1} = fullfile(root,'matlab','src','bits','normalize_gpu.cu') ;end
然后把 jaderberg-eccv2014_textspotting\matlab\src\下 5个.cu文件gconv.cugnormalize.cu gpool.cu gsepconv.cu gsepconv2.cu,还有 jaderberg-eccv2014_textspotting\matlab\src\bits下的所有文件(除了mexutils.h),分别拷贝到拷贝到matconvnet-master\matlab\src\ 和 matconvnet-master\matlab\src\bits下。
接着,在matconvnet-master\matlab\src文件夹下新建5个.cpp文件,为gconv.cpp, gnormalize.cpp , gpool.cpp , gsepconv.cpp , gsepconv2.cpp ,在这5个cpp文件#include各自对应的.cu文件。
比如,gconv.cpp内容为:
#if ENABLE_GPU#error This file should not be compiled with GPU support enabled#endif#include "gconv.cu"
gnormalize.cpp内容为:
#if ENABLE_GPU#error This file should not be compiled with GPU support enabled#endif#include " gnormalize.cu"
以此类推。
把vl_compilenn里的 opts.enableImreadJpeg 改为false, 其他不变。
matlab切换到 vl_compilenn.m根目录,以下列参数运行(只编译CPU版本):
vl_compilenn('enableGpu', false)
运行结果如下:
编译GPU版本命令如下:
vl_compilenn('enableGpu', true, ...'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5', ...'cudaMethod', 'nvcc')
'cudaRoot'设置为你windows上装CUDA的位置就行。
然后在mex目录下面就有.mexw64文件了。如下:
最后把这些.mexw64文件复制到jaderberg-eccv2014_textspotting\matconvnet\matlab\mex(即论文给的matlab代码文件下),便可以运行论文给的3个例子(fig_detmap.m,fig_charmap.m,reproduce_classifier_results.m)了。
这是我编译的mexw64文件。环境:Win7 x64,matlab2015a。
参考文献:deep features for text spotting 在linux,windows上使用
- deep features for text spotting 在windows上使用
- Learning Deep Features for Discriminative Localization
- Learning Deep Features for Discriminative Localization
- 《Learning Deep Features for Scene Recognition using Places Database》记录
- 深度学习入门:Aggregating Deep Convolutional Features for Image Retrieval
- 论文笔记 | Learning Deep Features for Discriminative Localization
- 论文阅读-《Learning Deep Features for Discriminative Localization》
- 论文笔记:Learning Deep Features for Discriminative Localization
- 行人属性“HydraPlus-Net: Attentive Deep Features for Pedestrian Analysis”
- 行人属性--HydraPlus-Net: Attentive Deep Features for Pedestrian Analysis
- 论文阅读-《Learning Deep Features for Discriminative Localization》
- Learning Deep Features for Discriminative Localization 笔记2
- 论文阅读-《Learning Deep Features for Discriminative Localization》
- Sublime text 2在windows上搭建C/C++环境
- 在Windows上使用Subversion
- 在Windows上使用Subversion
- 在Windows上使用Subversion
- 在Windows上使用Subversion
- java中类的权限
- 网络流之最大流 POJ 1273
- hdu5810——Balls and Boxes(数学推导)
- HDU 4778 Gems Fight!(博弈+状压)
- 【图形学与游戏编程】开发笔记-入门篇3:图形绘制
- deep features for text spotting 在windows上使用
- HDOJ 1789 Doing Homework again
- ListView的分页加载
- Java类
- Qt QToolTip详解
- 【杭电1081】To The Max
- Dijkstra 模板
- thinkphp注册
- 文章标题