forked from almazan/watts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextract_features.m
More file actions
25 lines (20 loc) · 780 Bytes
/
Copy pathextract_features.m
File metadata and controls
25 lines (20 loc) · 780 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function extract_features(opts)
disp('* Extracting FV features *');
% Extracts the FV representation for every image in the dataset
if ~exist(opts.fileFeatures,'file')
if ~exist(opts.fileGMM,'file')
toc = readImagesToc(opts.fileImages);
% Computes GMM and PCA models
idxTrainGMM = sort(randperm(length(toc),opts.numWordsTrainGMM));
[fid,msg] = fopen(opts.fileImages, 'r');
getImage = @(x) readImage(fid,toc,x);
images = arrayfun(getImage, idxTrainGMM', 'uniformoutput', false);
fclose(fid);
[GMM,PCA] = compute_GMM_PCA_models(opts,images);
writeGMM(GMM,opts.fileGMM);
writePCA(PCA, opts.filePCA);
clear images;
end
extract_FV_features_fast(opts);
end
end