deep features for text spotting 在linux,windows上使用
做文本检测这个方向的同学应该都知道 deep features for text spotting 这篇ECCV14的文章。
用的是Matconvnet这个是深度学习框架来做文本检测,同时他还提供了代码: eccv2014_textspotting
不过这个代码里的Matconvnet不同于原版本Matconvnet,原版本的内容比较全,而这个repository里的算是阉割版,同时还新加入了几个cpp,cu文件。。。
不幸的是,新加入的几个文件只在mac上有编译好的mex文件,linux上,windows上都需要自己编译。接下来就讲讲如何在linux和windows下编译这几个cpp,cu的mex文件。
linux 上的编译方法已经在repository中提到
. Edit matconvnet/Makefile to ensure MEX points to your matlab mex binary. Optinally ENABLE_GPU.
2. cd matconvnet/ && make
已经提供了编译的模板,主要是要修改好matconvnet/Makefile_Linux中几个变量的路径,就可以直接编译了。
比如 我是Ubuntu上装的CUDA7.0就修改如下:
MEX ?= /usr/local/MATLAB/R2014b/bin/mex
MEXARCH = mexa64
NVCC ?= /usr/local/cuda-7.0/bin/nvcc
ENABLE_GPU = true
MEXOPTS_GPU= $(MEXOPTS) -DENABLE_GPU -L /usr/local/cuda-7.0/targets/x86_64-linux/lib -lcudart -lcublas -lcudadevrt -f matlab/src/mex_CUDA_glnxa64.sh
然后重命名Makefile_linux为Makefile,然后 cd matconvnet/,然后 make
这里提供我编译好的 .mexa64文件,:linux_version 。 注意:我在Ubuntu下用cuda7.0编译的,matlab版本是2014b。
把这些mex文件放在 matconvnet\matlab\mex下就能跑整个代码了。
linux下用还是有点不方便,接下来主要讲一下windows下的编译
说来惭愧,本来想自己看明白makefile,然后逐个逐个编译的,但是在不知道nvcc和mex这两编译器该怎么个顺序,用啥编译参数,后来只能偷懒了。
Makefile里面说道了,主要是编译一下几个文件
cpp_src:=matlab/src/bits/im2col.cpp
cpp_src+=matlab/src/bits/pooling.cpp
cpp_src+=matlab/src/bits/normalize.cpp
mex_src:=matlab/src/gconv.cu
mex_src+=matlab/src/gpool.cu
mex_src+=matlab/src/gnormalize.cu
mex_src+=matlab/src/gsepconv.cu
mex_src+=matlab/src/gsepconv2.cu
cpp_src+=matlab/src/bits/im2col_gpu.cu
cpp_src+=matlab/src/bits/pooling_gpu.cu
cpp_src+=matlab/src/bits/normalize_gpu.cu
用过通用版的Matconvnet会有记得那边的windows编译很方便很简单,所以就直接用那边的程序编译了。
首先去下载一个通用版本的 Matconvnet : 通用版Matconvnet。
然后用他提供的 matconvnet-master\matlab\vl_compilenn.m 进行编译,修改 vl_compilenn 这个文件里面 185来行的代码,原本是这样:
if opts.enableGpu, ext = 'cu' ; else ext='cpp' ; end
lib_src{end+} = fullfile(root,'matlab','src','bits',['data.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['datamex.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['nnconv.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['nnfullyconnected.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['nnsubsample.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['nnpooling.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['nnnormalize.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['nnbnorm.' ext]) ;
lib_src{end+} = fullfile(root,'matlab','src','bits',['nnbias.' ext]) ;
mex_src{end+} = fullfile(root,'matlab','src',['vl_nnconv.' ext]) ;
mex_src{end+} = fullfile(root,'matlab','src',['vl_nnconvt.' ext]) ;
mex_src{end+} = fullfile(root,'matlab','src',['vl_nnpool.' ext]) ;
mex_src{end+} = fullfile(root,'matlab','src',['vl_nnnormalize.' ext]) ;
mex_src{end+} = fullfile(root,'matlab','src',['vl_nnbnorm.' ext]) ; % CPU-specific files
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','im2row_cpu.cpp') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','subsample_cpu.cpp') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','copy_cpu.cpp') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','pooling_cpu.cpp') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','normalize_cpu.cpp') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','bnorm_cpu.cpp') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','tinythread.cpp') ; % GPU-specific files
if opts.enableGpu
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','im2row_gpu.cu') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','subsample_gpu.cu') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','copy_gpu.cu') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','pooling_gpu.cu') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','normalize_gpu.cu') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','impl','bnorm_gpu.cu') ;
lib_src{end+} = fullfile(root,'matlab','src','bits','datacu.cu') ;
end
改成这样:
if opts.enableGpu, ext = 'cu' ; else ext='cpp' ; end
mex_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 files
lib_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 files
if 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
然后把 matconvnet-max-version\matlab\src\ 下 5个.cu文件 gconv.cu gnormalize.cu gpool.cu gsepconv.cu gsepconv2.cu ,还有 matconvnet-max-version\matlab\src\bits下的所有文件(除了mexutils.h),分别拷贝到拷贝到 matconvnet-master\matlab\src\ 和 matconvnet-master\matlab\src\bits下。
把vl_compilenn里的 opts.enableImreadJpeg 改为false, 其他不变。
matlab切换到 vl_compilenn.m根目录,以下列参数运行
vl_compilenn('enableGpu', true, ...
'cudaRoot', 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v6.5', ...
'cudaMethod', 'nvcc')
'cudaRoot'设置为你windows上装CUDA的位置就行。
然后在mex目录下面就有.mexw64文件了。 就这么简单。
这里给我自己编译的 : window64位cuda6.5
环境: x64,matlab2014b,cuda 6.5
deep features for text spotting 在linux,windows上使用的更多相关文章
- 在Mac/Linux/Windows上编译corefx遇到的问题及解决方法
这两天尝试在Mac/Linux/Windows三大平台上编译.NET跨平台三驾马车(coreclr/corefx/dnx)之一的corefx(.NET Core Framework),结果三个平台的编 ...
- Sublime Text编辑远程Linux服务器上的文件
sublime有个叫sftp的插件,可以通过它直接打开远程机器上的文件进行编辑,并在保存后直接同步到远程linux服务器上. 用Package Control安装插件 按下Ctrl+Shift+P调出 ...
- Docker在Linux/Windows上运行NetCore文章系列
Windows系列 因为Window很简单,VS提供界面化配置,所以只写了一篇文章 Docker在Windows上运行NetCore系列(一)使用命令控制台运行.NetCore控制台应用 Linux( ...
- Docker在Windows上运行NetCore系列(一)使用命令控制台运行.NetCore控制台应用
系列文章:https://www.cnblogs.com/alunchen/p/10121379.html 本篇文章操作系统信息 Windows:Window 10 Visual Studio:201 ...
- 如何实现在Windows上运行Linux程序,附示例代码
微软在去年发布了Bash On Windows, 这项技术允许在Windows上运行Linux程序, 我相信已经有很多文章解释过Bash On Windows的原理, 而今天的这篇文章将会讲解如何自己 ...
- .NET Core多平台开发体验[3]: Linux (Windows Linux子系统)
如果想体验Linux环境下开发和运行.NET Core应用,我们有多种选择.一种就是在一台物理机上安装原生的Linux,我们可以根据自身的喜好选择某种Linux Distribution,目前来说像R ...
- How To Configure SAMBA Server And Transfer Files Between Linux & Windows
If you are reading this article it means you have a network at home or office with Windows and Linux ...
- Linux (Windows Linux子系统)
Linux (Windows Linux子系统) 如果想体验Linux环境下开发和运行.NET Core应用,我们有多种选择.一种就是在一台物理机上安装原生的Linux,我们可以根据自身的喜好选择某种 ...
- windows平台是上的sublime编辑远程linux平台上的文件
sublime是个跨平台的强大的代码编辑工具,不多说. 想使用sublime完毕linux平台下django网站的代码编辑工作以提高效率(原来使用linux下的vim效率较低,适合编辑一些小脚本). ...
随机推荐
- 如何开启spring框架以注解形式的配置
步骤 导包(新版本需要导入spring-aop-4.3.17.RELEASE.jar) 为配置文件applicationContext.xml引入新的命名空间(约束) 开启使用注解 <?xml ...
- python基础知识(1)(个人整理)
import文件夹下的py文件: 情况1: `-- src |-- mod1.py `-- test1.py 直接 import mod1.py即可 情况2: -- src |-- mod ...
- mui is not defined
vue项目中引用mui.js,我是在main.js中这样引入的, 结果报错 查找资料,最后在mui.js的最后添加了这样一句 这是因为mui并不能像jquery那样作为全局对象存在,加上wi ...
- 浅析弹性公网IP付费模式和短时升配功能介绍
弹性公网IP付费模式对比 弹性公网IP(EIP),有两种付费方式.一种是预付费,一种是后付费.对于预付费弹性公网IP而言,最大的优点就是带宽费用便宜,相对于后付费有比较大的优惠. 例如,杭州地域6 ...
- DOS基础使用专题(强烈推荐)
DOS基础使用专题(强烈推荐) 美丽的DOS时代 DOS是世界上使用人数最多的操作系统,包括上面的Win3.x/9x等GUI操作平台的用户.尽管许多人由于种种原因而使用了其它非DOS的操作系统或操作环 ...
- php sqrt()函数 语法
php sqrt()函数 语法 作用:sqrt()函数的作用是对参数进行求平方根 语法:sqrt(X) 参数: 参数 描述 X 进行求平方根的数字 说明:返回将参数X进行开平方后的结果江苏大理石平台 ...
- POJ 2396 Budget (上下界网络流有源可行流)
转载: http://blog.csdn.net/axuan_k/article/details/47297395 题目描述: 现在要针对多赛区竞赛制定一个预算,该预算是一个行代表不同种类支出.列代表 ...
- Java和Tomcat的关系 Java如何发布web服务
https://blog.csdn.net/qq_31301961/article/details/80732669 除了Tomcat还有WebLogic 大型分布式的 如何部署映射 Tomcat使用 ...
- 点击按钮后URL呗改变
这里留个坑,Button默认类型是submit.没有写类型的,可能会导致触发Url改变.要么写类型,要么在按钮对应的Js方法里return.
- error C2065: “SHELLEXECUTEINFO”: 未声明的标识符
转自VC错误:http://www.vcerror.com/?p=1385 问题描述: error C2065: "SHELLEXECUTEINFO": 未声明的标识符 解决方法: ...