Prosenjit
Prosenjit

Reputation: 175

How multiple images are processed in CNN

In normal ANN each training sample is represented by a row of the matrix and in that way batches of training data can be processed but in CNN how multiple images are processed.

Upvotes: 0

Views: 595

Answers (1)

Giang Nguyen
Giang Nguyen

Reputation: 498

The same with ANN, you can stack up the images to n-dimensions tensor to be processed.

For CNNs that are trained on images, for example, say your dataset is RGB (3-channel) images that are 256x256 pixels. A single image can be represented by a 3 x 256 x 256 matrix. If you set your batch size to be 10, that means you’re concatenating 10 images together into a 10 x 3 x 256 x 256 matrix.

Tuning the batch size is one of the aspects of getting training right - if your batch size is too small, then there will be a lot of variance within a batch, and your training loss curve will bounce around a lot. But if it’s too large, your GPU will run out of memory to hold it, or training will progress too slowly to see if it’s the optimization is diverging early on.

Upvotes: 2

Related Questions