How to resolve this error?

This error is coming

This error arises due to memory overflow that means you are trying to allocate 10000224224*3 bits of memory, which comes out to nearly 11 gb of data, which is more than available ram memory.

The only way out is to load in batches.

Hope this helped :blush:

Then why didn’t this error come in sir’s video. and I think sir didn’t load in batches.

As i said it depends on ram size, your laptop may be having 8 gb of ram while the one with sir may have higher ram specifications.

yes u are right…
Can u tell what changes i need to make for this
I reduced m to some value but now getting this

just add these two lines after creating X and Y empty arrays.

random.shuffle(lines)
for i,line in enumerate(lines[:m]):

This will make your code run fine.


getting this

After m = len(lines) keep this line
m = int(m/10)

Ya it is working but what differences did it create?
and printing (X_val.shape )
is (1000,224,224,3) but it should be (100,224,224,3) as we have divided m by 10.

Make sure you are adding the line m = int(m/10) before initializing the X and Y array. Hopefully this will remove the above error. If the error persists, share the screenshot of your code.

Yes I have written this before initializing X and Y array ,But still my question is same as before regarding shape.

Please share link of your ipynb file, i need to debug it.

https://drive.google.com/file/d/1OJPB8S6k1arPBmNlvKSgh8GR3Qfzwg1Q/view?usp=sharing
this is link

Ya everything is fine. len(lines) = 10000, so m = 10000 and when you divide m/=10 than value of m becomes 1000, and so your x shape is accordingly 1000,224,224,3.

Hope now your doubt is resolved. :blush:

hmm …I didn’t see total number of images is 10,000 not 1000.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.