vlfeat / matconvnet

MatConvNet: CNNs for MATLAB
Other
1.4k stars 753 forks source link

how to train matconvnet as single-step instead of batch-learning? #126

Closed noorjugni closed 8 years ago

noorjugni commented 9 years ago

I am using am image dataset where each image is 1500x1300, so doing a batch-learning the matlab runs out of memory. Should I do a single-step learning? And how to do that? To train the matconvnet as single-step instead of batch-learning do we need to set opts.batchSize = 1; in cnn_train.m?

vedaldi commented 9 years ago

Hi, you could try the just released cnn_train.m and break a large sub batch into smaller one by using the numSubBatches option. This will pass the batch through the GPU incrementally and should avoid running out of memory.

Reducing the batch size is also an option, but may leat to instabilities in learning.

On 29 Apr 2015, at 07:21, noorjugni notifications@github.com wrote:

I am using am image dataset where each image is 1500x1300, so doing a batch-learning the matlab runs out of memory. Should I do a single-step learning? And how to do that? To train the matconvnet as single-step instead of batch-learning do we need to set opts.batchSize = 1; in cnn_train.m?

— Reply to this email directly or view it on GitHub https://github.com/vlfeat/matconvnet/issues/126.

noorjugni commented 9 years ago

I tried the latest cnn_train.m and used numSubBatches option, which solved the Out of memory problem. (Thanks) Here are a few things I would be grateful if you could please address: i) The new code prints the error for each batch something like this: obj:1.1 top1e:9.57e+04 The previous code would print error in %, for example 64% error. How do we interpret the new error reporting? ii) Is there any builtin function we can use to extract the confusion matrix which would show misclassification details, for example in case of 3 classes it will report c11 (as the # of class 1 examples being correctly classified), c12 (class 1 examples incorrectly classified as class 2), c32 (class 3 examples incorrectly classified as class 2) etc. iii) As I am new to CNN could you please comment on how the last layer can decide based on a single pixel value (in case of images like the handwritten digits)? Layer by layer the image (28x28) is being reduced and at the last layer only one pixel is left which is used to decide which of the ten digits it is. iv) Lastly, how should I select filter size for images of 1500x1300, pooling filter size and the number of layers? Are these selected just by trial n error, or is there any standard procedure?

rahman-mdatiqur commented 9 years ago

Hi @vedaldi , I am doing pixel-wise semantic prediction for which I need to set the batch size to 1. My question is, would it create any problem in converting the single image ( since batch size is 1) to a 4-D array, as Matlab drops any leading or trailing singleton dimensions?

I would highly appreciate your response.

vedaldi commented 9 years ago

Hi,

all of MatConvNet should assume that arrays have 4D even if MATLAB ndims() returns 3 or less. In fact, in MATLAB all arrays have implicitly infinite trailing singleton dimensions, and ndims() returns the number of non-singleton ones.

If you find that this is not the case, then you could file a bug report as it should not happen.

On 4 Aug 2015, at 23:31, atique81 notifications@github.com wrote:

Hi @vedaldi https://github.com/vedaldi , I am doing pixel-wise semantic prediction for which I need to set the batch size to 1. My question is, would it create any problem in converting the single image ( since batch size is 1) to a 4-D array, as Matlab drops any leading or trailing singleton dimensions?

I would highly appreciate your response.

— Reply to this email directly or view it on GitHub https://github.com/vlfeat/matconvnet/issues/126#issuecomment-127768406.