Skip to content

Commit

Permalink
svhn 28 28
Browse files Browse the repository at this point in the history
  • Loading branch information
Ragav Venkatesan committed Jun 29, 2017
1 parent b95bd2c commit e8169a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions pantry/matlab/make_svhn_28_28.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@

x = data( 1:train_size * batch_size ,:);
y = labels(1:train_size * batch_size);
x = re_size(x,[28,28,1]);
x = re_size(x,[28,28]);
dump( 'train',10, batch_size, x, y );

x = data( train_size * batch_size + 1 : train_size * batch_size + test_size * batch_size ,:);
y = labels(train_size * batch_size + 1 : train_size * batch_size + test_size * batch_size);
x = re_size(x,[28,28,1]);
x = re_size(x,[28,28]);
dump( 'test',10, batch_size, x, y );

x = data( (train_size + test_size) * batch_size + 1 : end ,:);
y = labels((train_size + test_size) * batch_size + 1 : end);
x = re_size(x,[28,28,1]);
x = re_size(x,[28,28]);
dump( 'valid',10, batch_size, x, y );
8 changes: 4 additions & 4 deletions pantry/matlab/re_size.m
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
function out = re_size (imgs, size)
function out = re_size (imgs, shape)

imgs = reshape(imgs, [size(imgs,1),sqrt(size(imgs,2)),sqrt(size(imgs,2)),3]);
out = zeros(size);
imgs = reshape(imgs, [size(imgs,1),sqrt(size(imgs,2)/3),sqrt(size(imgs,2)/3),3]);
out = zeros([size(imgs,1),shape]);

for i = 1:size(imgs,1)
out(i,:,:) = rgb2gray(squeeze(imgs(i,:,:,:)));
out(i,:,:) = imresize(rgb2gray(uint8(squeeze(imgs(i,:,:,:)))),[28,28]);
end
end

0 comments on commit e8169a0

Please sign in to comment.