STEP 1 : Create a virtual environment in model folder
cd model
pip install virtualenv
virtualenv venv
STEP 2 : Activate virtual environment :
venv\Scripts\activate
This command need administrative permissions. Use command prompt to execute this Will not work in powershell
STEP 3 : Install required libraries
pip install -r requirements.txt
STEP 4 : Run flask app
python app.py
After this the api will be up and running on : localhost:8080 You can now give api calls from react frontend.
API ROUTES :
NOTE :
NOTE :
- Here we are detecting only 3 directions (forward, left , right) because that is all we need.
- The number of detected directions can be increased.
- To detect more directions go to draw annotations function in pose_estimator.py file and elif conditions for more angles.
if angles[1] < -15:
GAZE = "Looking: Left"
elif angles[1] > 15:
GAZE = "Looking: Right"
else:
GAZE = "Forward"
NOTE :
The number of people detected can be changed via lowering the threshold To do that go to predict funtion in app.py and change the variable threshold Our default value is 0.5
threshold = 0.5