Age and Gender in tensorflow on a cpu or gpu!
Tensorflow based Age Gender Model (CPU + GPU)
Hardware | Inference Time (Milliseconds) |
---|---|
CPU | 750 (intel i-7) |
GPU | 430 (NVIDIA 2080) |
This model's inference time increases sublinearly with the number of people.
Detection | Accuracy |
---|---|
Face - Accurate | ~95% (frontal faces) (accurate model) |
Face - Fast | ~90% (frontal faces) (accurate model) |
Age | +- 5 years |
There are two detectors built into this container. You can toggle between them in the post parameters
Model | Description |
---|---|
Fast | dlib |
Accurate | tensorflow based cnn face detector |
#cpu
docker run -ti \\
-p 9090:9090 \\
sugarkubes/tensorflow-age-gender:cpu
#gpu
nvidia-docker run -ti \\
-p 9090:9090 \\
sugarkubes/tensorflow-age-gender:gpu
GET /
GET /health
GET /healthz
POST /predict
curl -X POST \\
http://0.0.0.0:9090/predict \\
-H 'Content-Type: application/json' \\
-d '{ "url": "https://s3.us-west-1.wasabisys.com/public.sugarkubes/repos/sugar-cv/object-detection/friends.jpg" }'
{
"face_detector": "fast", # One of ["accurate", "fast"]
"return_image": true, # use false for production/faster results
"url": 'https://your-image.jpg', # use url or b64 image
"b64": "", # base 64 encoded image
}
Variable | Default |
---|---|
PORT | 8080 |
HOST | 0.0.0.0 |
GPU | "" (true for GPU version) |
GPU_FRACTION | 0.25 (25% of the gpu will be allocated to this model) |
BASIC_AUTH_USERNAME | "" |
BASIC_AUTH_PASSWORD | "" |
{
// x1 y1 x2 y2 w h conf age gender
"faces": [[451, 0, 914, 452, 463, 514, -1, 37, "M"]],
"image_size": [1920, 1080],
"inference_time": 431.462,
}
BASIC_AUTH_USERNAME=""
and BASIC_AUTH_PASSWORD=""
BASIC_AUTH_USERNAME="root"
and BASIC_AUTH_PASSWORD="your password"