-
Notifications
You must be signed in to change notification settings - Fork 29
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 'pnet' is not defined #14
Comments
Hi geek-ash, Could you specify what Operating System you are working on? I have tried to recreate this issue on Ubuntu 18.04 on a virtualenv and a conda environment but I have found no issues. |
I am working on Windows 10 - Home (64). |
A rather strange suggestion, but try installing numpy version 1.16.2 instead of version 1.14 |
I already changed it to 1.16.1. I tried 1.16.2 too as you told but to no avail. |
I will try recreating this issue on Windows 10 tomorrow hopefully, could you provide a screenshot of your installed packages in the virtualenv by doing a pip list command? |
I replicated my venv with the packages you posted above (pip list) but to no avail.
|
BTW, I am running on my CPU. Hence, I don't have CUDA. I have just installed the requirements_cpu.txt. |
The issue is that you are running the server using the 'flask run' command, the models get defined and instantiated in the "if __ name __ == '__ main __ ' :" block, but because you are using the flask run command it makes __ name __ not equal to '__ main __' in this case, so the execution does not go through that block, and the MTCNN model (pnet, rnet, onet) and FaceNet model do not get defined and instantiated which causes your issue 'pnet is not defined'. In order to solve this, you can just call 'python server.py' and the execution would run correctly. If you wish to use the 'flask run' method, then you should move the code inside the "if __ name __ == '__ main __':" block to the top of the code under the allowed_set variable and delete the 'serve(app=app, host='0.0.0.0', port=5000)' statement and the code would work in your case. StackOverflow reference: https://stackoverflow.com/questions/58564162/what-is-the-difference-between-using-flask-run-vs-python-app-py-vs-python-m-fla I will add a note about this in the README file, please do notify me if other issues arise. |
Hey Tamer, |
Glad it worked 👍 |
When I run the server.py, the page loads correctly. But, when I upload a pic and click on submit, "NameError: name 'pnet' is not defined" appears. I am running in CPU mode, and I have installed all the required libraries in a virtualenv running on python 3.6.8.
Kindly help @tamerthamoqa
Thanks in Advance.
The text was updated successfully, but these errors were encountered: