Open hellorp1990 opened 8 years ago
This is the code that I used.....
function Tune(varargin)
% ------------------------------------------------------------------------- % Part 1: prepare the data % -------------------------------------------------------------------------
% Load dataset load('imdb.mat') ; % change imdb.images.data,imdb.images.label, imdb.images.set imdb.images.data = single (imdb.images.data );
% ------------------------------------------------------------------------- % Part 2: load CNN % ------------------------------------------------------------------------- net = initializeCharacterCNN() ;
% ------------------------------------------------------------------------- % Part 4.3: train and evaluate the CNN % ------------------------------------------------------------------------- trainOpts.gpus = []; %trainOpts.gpus = 1;%change it to [] for CPU trainOpts.batchSize = 1; trainOpts.numSubBatches = 1 ; trainOpts.numEpochs = 40 ; % change to number of iterations needed trainOpts.continue = true ; trainOpts.learningRate =[0.0001_ones(1,15) 0.00001_ones(1,15) 0.000001*ones(1,10)] ; %trainOpts.learningRate =0.0001; trainOpts.expDir = 'data/experiment' ; trainOpts = vl_argparse(trainOpts, varargin);
% Convert to a GPU array if needed numGpus = numel(trainOpts.gpus) ; if numGpus == 1 imdb.images.data = gpuArray(imdb.images.data) ; end
% Call training function in MatConvNet [net,info] = cnn_train(net, imdb, @getBatch, trainOpts) ;
% Move the CNN back to the CPU if it was trained on the GPU if numGpus == 1 net = vl_simplenn_move(net, 'cpu') ; end
% -------------------------------------------------------------------- function [im, labels] = getBatch(imdb, batch) % --------------------------------------------------------------------
%im = imdb.images.data(:,:,:,batch) ; im = imdb.images.data(:,:,batch) ; labels = imdb.images.label(1,batch) ; % --------------------------------------------------------------------
@vedaldi and others.. any suggestion on this?
@hellorp1990 Hey Raul. Try different batch size. Also it may be needed to normalize the batches.
I think it is not related with batch size. Try different learning rate. Decrease your learning rate.
Hello Everyone,
I am trying to use my own dataset and CNN architecture(I took the cnn architecture from the example section of matconvnet) . The result is coming quite odd. top5 error is coming zero and obj value is Nan.
Can anyone suggest me whats going wrong.