A people tracking system using YOLOv3 to analyze customer behavior inside an establishment.
Install the following packages
pip install pillow numpy requests
pip install opencv-python
pip install moviepy
First you have to start the docker APIs
docker-compose dockers\docker-compose.yml build
docker-compose dockers\docker-compose.yml up -d
Than you can test the API by running the demo.py
file.
python demo.py
To call the API use the following.
An HTTP Post request with an image as data
in base64
URL:
http://0.0.0.0:7000/predict
Python example using OpenCV:
import requests
import base64
import cv2
# Read the example image
img = cv2.imread("image.jpg")
# Transform the image to base64
_, buffer = cv2.imencode('.jpg', img)
img_str = base64.b64encode(buffer)
# POST request to a Localhost (this can be changed for public or private ip)
req = requests.post('http://localhost:7000/predict', data=img_str)
# Print results
print(req.json())
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.