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

NameError: name 'preds' is not defined #1

Pranjalab opened this issue Oct 6, 2018 · 6 comments


Copy link

@Pranjalab Pranjalab commented Oct 6, 2018

Hello Omar Ayman,
I find this Project very interesting so I tried it. but when the model does not detect any face then line 53 thoughts error because the 'preds' is defined inside the if condition.
Thank You :-)


This comment has been minimized.

Copy link

@omar178 omar178 commented Oct 8, 2018

Hey man,
this error appears sometimes and i can't find a reason why is this error raising but what i did is that whenever it appears i run the script again and it worked, stupid solution till i find what really causing it.

@omar178 omar178 closed this Oct 8, 2018

This comment has been minimized.

Copy link

@kevinjosue2326 kevinjosue2326 commented Nov 1, 2018

I'm exactly the same, but as much as I run the script does not work: this is my log:
Using TensorFlow backend.
2018-10-31 19:07:29.243116: I tensorflow/core/platform/] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2018-10-31 19:07:29.494922: I tensorflow/core/common_runtime/gpu/] Found device 0 with properties:
name: TITAN V major: 7 minor: 0 memoryClockRate(GHz): 1.455
pciBusID: 0000:01:00.0
totalMemory: 12.00GiB freeMemory: 9.67GiB
2018-10-31 19:07:29.502864: I tensorflow/core/common_runtime/gpu/] Adding visible gpu devices: 0
2018-10-31 19:07:30.692378: I tensorflow/core/common_runtime/gpu/] Device interconnect StreamExecutor with strength 1 edge matrix:
2018-10-31 19:07:30.696807: I tensorflow/core/common_runtime/gpu/] 0
2018-10-31 19:07:30.699723: I tensorflow/core/common_runtime/gpu/] 0: N
2018-10-31 19:07:30.709265: I tensorflow/core/common_runtime/gpu/] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 9272 MB memory) -> physical GPU (device: 0, name: TITAN V, pci bus id: 0000:01:00.0, compute capability: 7.0)
Traceback (most recent call last):
File "", line 53, in
for (i, (emotion, prob)) in enumerate(zip(EMOTIONS, preds)):
NameError: name 'preds' is not defined


This comment has been minimized.

Copy link

@LiuWenzhang LiuWenzhang commented Dec 13, 2018

Add a line "else: continue" after the condition code "if len(faces) > 0:", then run the script and it will work.


This comment has been minimized.

Copy link

@pymacbit pymacbit commented Apr 21, 2019

Python code line Structure error causing this problem. the solution for this is to manage the for loop in a structured way so that it will able to read 'preds'.

Problem :

Solution :

Hope you have found what you were looking For. :)


This comment has been minimized.

Copy link

@gerardo-junior gerardo-junior commented Sep 9, 2019

#20 PR with fixing


This comment has been minimized.

Copy link

@skakmat02 skakmat02 commented Nov 11, 2019

just add this line :


Screenshot from 2019-11-11 15-44-37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
7 participants
You can’t perform that action at this time.