资源简介
很详细的PCANet资源,有利于学习。数据资源,代码资源全部都有。
代码片段和文件信息
% ==== PCANet Demo =======
% T.-H. Chan K. Jia S. Gao J. Lu Z. Zeng and Y. Ma
% “PCANet: A simple deep learning baseline for image classification?“ submitted to IEEE TIP.
% ArXiv eprint: http://arxiv.org/abs/1404.3606
% Tsung-Han Chan [thchan@ieee.org]
% Please email me if you find bugs or have suggestions or questions!
% ========================
clear all; close all; clc;
addpath(‘./Utils‘);
addpath(‘./Liblinear‘);
TrnSize = 10000;
ImgSize = 32;
%% Loading data from CIFAR10 (50000 training 10000 testing)
DataPath = ‘./cifar-10-batches-mat‘;
% CIFAR10 dataset can be downloaded at http://www.cs.toronto.edu/~kriz/cifar.html
TrnLabels = [];
TrnData = [];
for i = 1:5
load(fullfile(DataPath[‘data_batch_‘ num2str(i) ‘.mat‘]));
TrnData = [TrnData data‘];
TrnLabels = [TrnLabels; labels];
end
load(fullfile(DataPath‘test_batch.mat‘));
TestData = data‘;
TestLabels = labels;
ImgFormat = ‘color‘; %‘gray‘
TrnLabels = double(TrnLabels);
TestLabels = double(TestLabels);
%% For this demo we subsample the Training and Testing sets
% plz comment out the following four lines for a complete test.
% when you want to do so please ensure that your computer memory is more than 64GB.
% training linear SVM classifier on large amount of high dimensional data would
% requires lots of memory.
TrnData = TrnData(:1:50:end); % sample around 1000 training samples
TrnLabels = TrnLabels(1:50:end); %
TestData = TestData(:1:10:end); % sample around 1000 test samples
TestLabels = TestLabels(1:10:end);
%%%%%%%%%%%%%%%%%%%%%%%%
nTestImg = length(TestLabels);
%% PCANet parameters (they should be funed based on validation set; i.e. ValData & ValLabel)
PCANet.NumStages = 2;
PCANet.PatchSize = [5 5];
PCANet.NumFilters = [40 8];
PCANet.HistBlockSize = [8 8];
PCANet.BlkOverLapRatio = 0.5;
PCANet.Pyramid = [4 2 1];
fprintf(‘\n ====== PCANet Parameters ======= \n‘)
PCANet
%% PCANet Training with 10000 samples
fprintf(‘\n ====== PCANet Training ======= \n‘)
TrnData_ImgCell = mat2imgcell(double(TrnData)ImgSizeImgSizeImgFormat); % convert columns in TrnData to cells
tic;
[ftrain V BlkIdx] = PCANet_train(TrnData_ImgCellPCANet1); % BlkIdx serves the purpose of learning block-wise DR projection matrix; e.g. WPCA
PCANet_TrnTime = toc;
%% PCA hashing over histograms
c = 10;
fprintf(‘\n ====== Training Linear SVM Classifier ======= \n‘)
display([‘now testing c = ‘ num2str(c) ‘...‘])
tic;
models = train(TrnLabels ftrain‘ [‘-s 1 -c ‘ num2str(c) ‘ -q‘]); % we use linear SVM classifier (C = 10) calling liblinear library
LinearSVM_TrnTime = toc;
%% PCANet Feature Extraction and Testing
TestData_ImgCell = mat2imgcell(TestDataImgSizeImgSizeImgFormat); % convert columns in TestData to cells
clear TestData;
fprintf(‘\n ====== PCANet Testing ======= \n‘)
nCorrRecog = 0;
RecHistory = zeros(nTestImg1);
tic;
for idx = 1:1:nTestImg
ftest
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2014-08-29 09:52 PCANet_demo\
目录 0 2014-08-29 09:52 PCANet_demo\cifar-10-batches-mat\
文件 4110 2014-08-29 09:51 PCANet_demo\Demo_cifar10.m
文件 4119 2014-08-29 09:50 PCANet_demo\Demo_mnist_basic.m
文件 5190 2014-08-29 09:44 PCANet_demo\HashingHist.m
目录 0 2014-08-29 09:52 PCANet_demo\Liblinear\
文件 4226 2011-08-26 22:25 PCANet_demo\Liblinear\libsvmread.c
文件 11225 2013-09-24 05:36 PCANet_demo\Liblinear\libsvmread.mexa64
文件 10752 2013-08-25 19:42 PCANet_demo\Liblinear\libsvmread.mexw64
文件 2254 2011-08-26 22:25 PCANet_demo\Liblinear\libsvmwrite.c
文件 9463 2013-09-24 05:36 PCANet_demo\Liblinear\libsvmwrite.mexa64
文件 9216 2013-08-25 19:42 PCANet_demo\Liblinear\libsvmwrite.mexw64
文件 3726 2012-04-16 21:50 PCANet_demo\Liblinear\linear_model_matlab.c
文件 168 2008-09-06 19:07 PCANet_demo\Liblinear\linear_model_matlab.h
文件 910 2012-10-18 17:51 PCANet_demo\Liblinear\make.m
文件 1764 2011-05-09 16:37 PCANet_demo\Liblinear\Makefile
文件 8629 2012-10-09 21:49 PCANet_demo\Liblinear\predict.c
文件 66845 2013-09-24 05:36 PCANet_demo\Liblinear\predict.mexa64
文件 16384 2013-08-25 19:42 PCANet_demo\Liblinear\predict.mexw64
文件 7349 2012-04-16 22:26 PCANet_demo\Liblinear\README
文件 10947 2012-07-20 00:59 PCANet_demo\Liblinear\train.c
文件 68273 2013-09-24 05:36 PCANet_demo\Liblinear\train.mexa64
文件 58880 2013-08-25 19:42 PCANet_demo\Liblinear\train.mexw64
目录 0 2014-08-29 09:52 PCANet_demo\MNISTdata\
文件 23859010 2013-10-29 04:03 PCANet_demo\MNISTdata\mnist_basic.mat
文件 1716 2014-08-29 09:41 PCANet_demo\PCANet_FeaExt.m
文件 3230 2014-08-29 09:41 PCANet_demo\PCANet_train.m
文件 1248 2014-08-29 00:32 PCANet_demo\PCA_FilterBank.m
文件 1465 2014-07-31 00:15 PCANet_demo\PCA_output.m
目录 0 2014-08-29 09:52 PCANet_demo\Utils\
文件 1341 2009-08-31 20:17 PCANet_demo\Utils\im2colstep.m
............此处省略5个文件信息
- 上一篇:PMP中文第六版
- 下一篇:英语单词管理系统ssh+数据库+easyUI+等等
评论
共有 条评论