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效率较低,适合编辑一些小脚本). ...
随机推荐
- mysql中的key primary key 和unique key
mysql 中key就等同于index 所以 key:普通索引 unique key:唯一索引,就是这一列不能重复 primary key:主键索引,就是不能为空,且主键索引不是完全相同时,插入新数据 ...
- Linux命令"ls"进阶说明
pwd:the current working directory cd -: return to the previous working directory Filenames that begi ...
- 【leetcode】472. Concatenated Words
题目如下: Given a list of words (without duplicates), please write a program that returns all concatenat ...
- cf 1263
A #include<bits/stdc++.h> using namespace std; int main(){ int t;cin>>t; while(t--){ ]; ...
- 【HDOJ6600】Just Skip The Problem(签到)
题意:询问n!模1e6+7的结果 n<=1e9 思路: #include<bits/stdc++.h> using namespace std; typedef long long ...
- CF 452E. Three strings(后缀数组+并查集)
传送门 解题思路 感觉这种题都是套路之类的??首先把三个串并成一个,中间插入一些奇怪的字符,然后跑遍\(SA\).考虑按照\(height\)分组计算,就是每个\(height\)只在最高位计算一次, ...
- 怎么更改win7登录界面
方法/步骤 1 第一步,先打开注册表.快捷键是win+R.Win就是Windows图片那个键.打开会是这个. 2 在其中输入Regedit.就打开了传说中的注册表了.然后在注册表中选择.选择的顺序 ...
- jerry
jerry 题目描述 众所周知,Jerry 鼠是一只非常聪明的老鼠. Jerry 聪明到它可以计算64 位有符号整形数字的加减法. 现在,Jerry 写下了一个只由非负整数和加减号组成的算式.它想给这 ...
- LintCode之各位相加
题目描述: 我的代码 public class Solution { /* * @param num: a non-negative integer * @return: one digit */ p ...
- jmeter添加自定义扩展函数之MD5加密
1,打开eclipse,新建maven工程,在pom中引用jmeter核心jar包,具体请看---https://www.cnblogs.com/guanyf/p/10863033.html---,这 ...