Ubuntu15.04 + Matlab2014a + MatConvNet install and compile

本文介绍了MatConvNet工具箱的下载与配置过程,并演示了如何利用预训练模型进行图像分类。MatConvNet是一个用于计算机视觉应用的MATLAB工具箱,能够运行和学习先进的卷积神经网络。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

MatConvNet is a MATLAB toolbox implementingConvolutional NeuralNetworks (CNNs) for computer vision applications. It is simple,efficient, and can run and learn state-of-the-art CNNs. Severalexample CNNs are included to classify and encode images.

1. Download MatConvNet

https://github.com/vlfeat/matconvnet

2. Make sure that MATLAB is configured to use your compiler.

3. Compiling the CPU support

Open MATLAB and issue the commands:

> cd <MatConvNet>
> addpath matlab
> vl_compilenn

At this point MatConvNet should start compiling. If all goes well, youare ready to use the library. If not, you can try debugging theproblem by running the complation script again in verbose mode:

> vl_compilenn('verbose', 1)
4. Compiling the GPU support


Assuming that there is only a single copy of the CUDA toolkitinstalled in your system and that it matches MATLAB's version, compilethe library with:

> vl_compilenn('enableGpu', true)
 

If you have multiple versions of the CUDA toolkit, or if the scriptcannot find the toolkit for any reason, specify the path to the CUDAtoolkit explicitly. For example, on a Mac this may look like:

> vl_compilenn('enableGpu', true, 'cudaRoot', '/Developer/NVIDIA/CUDA-6.0')

5. Examples

% setup MtConvNet in MATLAB
run matlab/vl_setupnn

% download a pre-trained CNN from the web
urlwrite('http://www.vlfeat.org/sandbox-matconvnet/models/imagenet-vgg-f.mat', ...
  'imagenet-vgg-f.mat') ;
net = load('imagenet-vgg-f.mat') ;

% obtain and preprocess an image
im = imread('peppers.png') ;
im_ = single(im) ; % note: 255 range
im_ = imresize(im_, net.normalization.imageSize(1:2)) ;
im_ = im_ - net.normalization.averageImage ;

% run the CNN
res = vl_simplenn(net, im_) ;

% show the classification result
scores = squeeze(gather(res(end).x)) ;
[bestScore, best] = max(scores) ;
figure(1) ; clf ; imagesc(im) ;
title(sprintf('%s (%d), score %.3f',...
net.classes.description{best}, best, bestScore)) ;


reference url:

http://www.vlfeat.org/matconvnet/mfiles/vl_compilenn/

http://www.vlfeat.org/matconvnet/install/

http://www.vlfeat.org/matconvnet/pretrained/

评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值