This is a minimal implementation of face-detection models using flask, gunicorn, nginx, docker, and docker-compose
This is a simple implementation of dockerized face-detection restful-API implemented with flask, Nginx, and scaled up with Gunicorn. This web service takes in an image and returns face-box coordinates.
workers
in the docker-compose.yml
file.FACE_DETECTION_MODEL
in the docker-compose.yml
file.app/base_app.py
file.~/.deep_utils
directory and place it inside app/weights
directory. This will save you tons of time while working with models with
heavy weights.tensorflow
, comment the pytorch
installation section in app/Dockerfile
and
uncomment the tensorflow
installation lines.To run the API, install docker
and docker-compose
, execute the following command:
docker-compose up --build
sudo docker-compose up --build
To send an image and get back the boxes run the following commands:
curl --request POST ip:port/endpoint -F image=@img-add
If you run the service on your local system the following request shall work perfectly:
curl --request POST http://127.0.0.1:8000/face -F image=@./sample-images/movie-stars.jpg
The output will be as follows:
{
"face_1":[269,505,571,726],
"face_10":[73,719,186,809],
"face_11":[52,829,172,931],
"face_2":[57,460,187,550],
"face_3":[69,15,291,186],
"face_4":[49,181,185,279],
"face_5":[53,318,205,424],
"face_6":[18,597,144,716],
"face_7":[251,294,474,444],
"face_8":[217,177,403,315],
"face_9":[175,765,373,917]
}
If you find something missing, please open an issue or kindly create a pull request.
1.https://github.com/pooya-mohammadi/deep_utils
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and limitations under the License.