Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Error #2

Open
haridatascientist opened this issue Apr 26, 2016 · 3 comments
Open

Memory Error #2

haridatascientist opened this issue Apr 26, 2016 · 3 comments

Comments

@haridatascientist
Copy link

Hi,
I run demo.py for a single image. it worked well

When I run more than 300 images in a loop in windows 32bit it shows the following error
Traceback (most recent call last):
  File "demo.py", line 75, in
    demo()
  File "demo.py", line 57, in demo
    frontal_raw, frontal_sym = frontalize.frontalize(img, proj_matrix, model3D.r
ef_U, eyemask)
  File "C:\Users\Hubino\Downloads\face-frontalization-master\face-frontalization
-master\frontalize.py", line 88, in frontalize
    denominator = weights + weight_take_from_org + weight_take_from_sym
MemoryError

How to avoid the memory error

Thanks in advance for your valuable help

@dougsouza
Copy link
Owner

dougsouza commented Apr 26, 2016

Hi @haridatascientist

As you posted, the line that is throwing the error is:

denominator = weights + weight_take_from_org + weight_take_from_sym

This is a simple Numpy matrix addition which shouldn't be a problem. It seems that you are running out of memory to perform this operation. Are you seeing this error specifically after frontalizing more than 300 images? Are you keeping all those images in memory? I suggest you keep track of your memory usage. One thing you can do is write the image to disk after you frontalize in order to free memory space.

If you want to go further, you can check which Numpy operations are not inplace and optimize the memory usage as they mention here: http://stackoverflow.com/questions/4318615/python-numpy-memoryerror. But I don't think this would solve the problem if you're trying to keep this many images loaded in memory.

Hope it helps!

@adilalazzawi
Copy link

adilalazzawi commented Oct 12, 2016

Hi @dougsouza
I tried to run the code but I got an error

image

@adilalazzawi
Copy link

Hi @haridatascientist
could you send me the instruction that you used to run demo().py I tried to run it but i got some errrors
my email is [email protected] could you send me the code that you used and the instructions please???

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants