-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregireg_getDeepX.m
25 lines (22 loc) · 969 Bytes
/
regireg_getDeepX.m
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 [ X, featList ] = regireg_getDeepX( network, layerchoice, stimchoice )
% Given a network, layer of network and a directory with stimuli, this
% function creates an X matrix with rows corresponding to stimuli and
% columns corresponding to deep unit activations (deep artificial neurons)
% Make a list of the stimuli file names
featdir = ['./features/' network '_' stimchoice '/'];
featList = natsort(getAllFiles(featdir));
featList = vertcat(featList(49:end), featList(1:48)); % moving Regular first like Kayaert's paper
% Load a random image from featdir to find the index of the given layer
% (layerchoice)
fnames = dir(featdir);
load([featdir fnames(3).name]);
IndexC = strcmp(feature(:,2), layerchoice);
Index = find(IndexC>0);
% Initialize and create a matrix where:
% Rows : all the images
% Columns: all features/activations for given layer(layerchoice)
X = [];
for i=1:numel(featList)
load(featList{i});
X(i,:) = feature{Index,1}(:);
end