Open geek-ash opened 4 years ago
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?
Hello geek-ash,
I am honestly confused. I have tried recreating this issue on Windows 10 on a virtualenv and conda environment but I also have had no issues. I have also tried downloading the project as a zip file instead of a git clone command in case the compression caused issues in certain files but I also have had no issues.
Here is the list from the pip list command for my virtualenv:
I have tried installing the tensorflow-estimator package and downgraded the gast package in the case any of the packages was causing the issue but I also have had no issues. Could you specify the steps you made while preparing the project? Because I honestly have no idea what is causing the issue on your end.
I replicated my venv with the packages you posted above (pip list) but to no avail. Following are the steps I followed: 1) I created a virtualenv using the 'python36 -m virtualenv venv5' 2) Downloaded the project as a zip file. then Extracted it and copied all the contents in my venv5 3) Downloaded the model and extracted it. 3) Then I edited the requirements_cpu.txt file to make it the same as the packages and versions you posted in the above comment (pip list). 4) Then I run the command pip3 install -r requirements_cpu.txt on the cmd in my active venv5. 5) Copied the 4 model files to the folder named model in the venv5 so that the path of the 20170512-110547.pb is ...\venv5\model\20170512-110547\20170512-110547.pb. 6) Then run the following three commands on the cmd set FLASK_ENV=development set FLASK_APP=server.py flask run 7) Then I opened http://127.0.0.1:5000/ in chrome. 8) It showed that no it could not find 'lib'. So, I checked my venv5 folder and found that the 'lib' folder I copied from the project went into the 'Lib' folder that was created with the venv5. So, I renamed that folder as 'lib'. 9) Then I reloaded the page in chrome, and it worked! 10) Then I clicked on 'Choose File' and selected a picture of mine in jpg format. 11) Then upon clicking 'Submit' the error 'NameError: name 'pnet' is not defined' came on the webpage! This is where I am stuck.
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, Thank you for the help! I really missed that :)
Glad it worked :+1:
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.