FCN图像语义分割

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/zhjm07054115/article/details/51569450

欢迎访问人工智能研究网课程中心

studyai.com

-----------------------------------------------------------------------------------


FCN做图像语义分割--测试和训练


FCN  论文:Fully Convolutional Networks for Semantic Segmentation(FC-Model).pdf

FCN  原理:

FCN  代码:基于MatConvNet构建模型

  1. 下载源码,放到根目录E:MatConvNet-fcn-master

  2.  配置matconvnet,  拷贝matconvnet-beta16版本到根目录下. 并进行编译。
       CPU编译直接运行 vl_compilenn()。
       GPU编译最好用CUDA7.5,如果是titanx等计算能力在5.2的卡,cuda6.5编译会报错“compute 52 xxx 错”。
       若电脑中同时有cuda6.5/cuda7.5,要在函数cuda_root = search_cuda_devkit(opts)中设置nvcc=nvcc(index(2)),
       而且要检查,系统变量中 CUDA_PATH和 CUDA_Samples_PATH的路径是在7.5下。
       编译前,还要拷贝cudnnxx.dll到matcoonvnet的mex文件夹下,以提供对cudnn的支持。
       编译前,还要在vl_compilenn()中加上 “v7.5”这个CUDA版本号,直接搜素"v6.5"就到了对应位置。

  3.  拷贝ZF模型和VGG模型,注意是-beta16版格式的,其他版本会报错,到FCN的data/modles路径下。

  4.  配置VOC2011数据集,进行训练。训练主函数 fcnTrain()。
       配置数据集根据错误调试掉BUG.
       
function fcnTrain(varargin)
%FNCTRAIN Train FCN model using MatConvNet

run matconvnet/matlabl_setupnn ;
addpath matconvnet/examples ;

% experiment and data paths
opts.archiveDir = fullfile('F:','VOC2011'); % 下载原始数据
opts.dataDir = fullfile('F:','VOC2011','VOCtrainval');
opts.expDir = fullfile('data','fcn16s-voc11-train');
opts.modelType = 'fcn16s' ;
opts.sourceModelPath = 'data/models/imagenet-vgg-verydeep-16.mat'; %-beta16版本
[opts, varargin] = vl_argparse(opts, varargin) ;

% experiment setup
opts.imdbPath = fullfile(opts.expDir, 'imdb.mat') ;
opts.imdbStatsPath = fullfile(opts.expDir, 'imdbStats.mat') ;
opts.vocEdition = '11' ;
opts.vocAdditionalSegmentations = true ;

opts.numFetchThreads = 1 ; % not used yet

% training options (SGD)
opts.train.batchSize = 20 ;
opts.train.numSubBatches = 10 ;
opts.train.continue = true ;
opts.train.gpus = 1 ;
opts.train.prefetch = true ;
opts.train.expDir = opts.expDir ;
opts.train.learningRate = 0.0001 * ones(1,50) ;
opts.train.numEpochs = numel(opts.train.learningRate) ;

opts = vl_argparse(opts, varargin) ;

5. 测试FCN,注意使用fcnTest ,   运行如下。。。。。



本博客所有案例程序 提供源码 和 安装运行指导!

需要的可以加Q群 625691515


        

猜你喜欢

转载自blog.csdn.net/zhjm07054115/article/details/51569450