Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Thread Subject:
im2col memory problems

Subject: im2col memory problems

From: Eric Diaz

Date: 9 Apr, 2012 00:53:11

Message: 1 of 2

y is a matrix of type double and size 1110x1170.

ksz = 11;
rad = (ksz-1)/2;
I = im2col(padarray(y, [rad rad], 'symmetric'),[ksz ksz], 'sliding');

im2col is killing my machine and making it come to a near crawl. Before running the above, I have MATLAB open with y in the workspace and I'm going from nearly 2.2gb free to only 5mb of free memory left on a 4gb computer and taking forever (like greater than 10 minutes) to accomplish.

Is there another way that I can get the same result without having such huge memory problems?

Subject: im2col memory problems

From: Eric Diaz

Date: 9 Apr, 2012 02:09:14

Message: 2 of 2

I've figure out that the main reason it's taking up so much memory is because of the size of the matrix I, which is 121 rows x 1887000 columns, which turns out to require 1,826,600,000 bytes or 1.8 gigabytes! EEEk!!! Unfortunately, it is not anywhere near being a sparse matrix, so I can't go that route. I can reduce the radius size and that will greatly reduce the needed space, but that will make the larger function, within which this one operates, work less effectively. It would be nice if I could split the matrix I, into blocks that get loaded as needed, instead of having the whole matrix in memory. Any suggestions on an effective way to accomplish this?

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us