The aim of the project is to provide service runed in Docker with API FastAPI interface which predicts age with custom finetuned neural-network model over the existent fine face extractor.
Date of creation: 7 September 2023
Component | Details |
---|---|
Docs API | Swagger |
UI | is out of task |
Component | Details |
---|---|
Extraction framework | Deepface |
Selected extraction backend | mtcnn |
Age model | custom |
Age backbone | Facenet |
Age dataset | UTKFace_Dataset cropped |
1.A) Create docker image
docker build -f ./docker/Dockerfile -t local/nvidia_conda:face_detection_age .
1.B) Load custom weights for age module https://disk.yandex.ru/d/oC-5YQYaHAS-ag and place it in ${project_folder}/age_module/weights
- Run from the project folder with desired GPU amount in interactive mode
cur_folder=$(realpath ./);
sudo docker run --gpus all --rm -it \
-v $cur_folder:/home \
-p 8000:2020 \
local/nvidia_conda:face_detection_age
- Start FastAPI
cd ./home/age_module; uvicorn app.app:app --reload --port 2020 --host 0.0.0.0
Done. The app is ready to operate now.
Swagger UI is available for above settings:
Optional: try on example image
curl -X 'POST' \
'http://127.0.0.1:8000/api/predict_photo' \
-H 'accept: application/json' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@./age_module/tests/data/116_1_0_20170120134921760.jpg.chip.jpg;type=image/jpeg'
Age training dataset "UTKFace Cropped" migrated to www.kaggle.com/datasets/abhikjha/utk-face-cropped
Balance load