Detects whether human faces in an image are wearing Face Mask, and returns face rectangles (green for mask and red for no-mask), number of people with masks and without masks in the image, and co-ordinates of the rectangles on the image.

  • Privacy : No image will be stored. Only the extracted face feature(s) will be stored on the server. The stored face features will expire and be deleted 24 hours after the original detection call.

  • Minimum detectable face size: 36 x 36 pixels face in an image no larger than 1920 x 1080 pixels. Images with dimensions higher than 1920 x 1080 pixels will need a proportionally larger minimum face size.

  • The maximum number of faces: Up to 200 faces can be returned for an image. 

  • Hardware Required for Real-time Inference:

    GPU: GTX 1070, GTX 1080, GTX 1070 Ti, or GTX 1080 Ti

    CPU: 1-2 cores per GPU > 2 GHz; CPU should support the number of GPUs that you want to run. 

    RAM: At least as much CPU RAM to match the RAM of your largest GPU.

    Hard drive/SSD: Hard drive for data (>= 3TB)

  • Faces are ranked by face rectangle size from large to small.

HTTP Method POST

Request URL

https://api.skylarklabs.ai/face-mask/

Request parameters

None

Request headers

None

Request body

  • form-data

KEY

VALUE

DESCRIPTION

image

image file ( jpg, png )

The image that needs to be processed.

key

String (eg. 3bf26a02418194389aeec614e9df6c0eba0c439a6fe3f4590d4f11be24a76d0b)

The API Key generated against a project

Response 403 ( Forbidden )
{
    "detail": "provide a valid api key"
}
JSON
Response 200 ( Success )
{
    "id": 707,
    "created_at": "2020-07-17T18:15:55.559486Z",
    "updated_at": "2020-07-17T18:15:55.559528Z",
    "status": "pending",
    "response_json": null,
    "logs": null,
    "image": "http://api.skylarklabs.ai/media/face_mask/8a19471f83464643bb0a85368911cb21.jpg",
    "output_image": null,
    "owner": 1
}
JSON

KEY

TYPE

DESCRIPTION

id

Integer

Unique ID of the request, created by face-mask API.

created_at

String

Date and Time of the moment the request was created.

updated_at

String

Date and Time of the moment the request was updated.

status

String

Indicates status of the request, can take values [ ‘success’, ‘failed’, ‘pending’].

  • Success : The processing is completed

  • Failed : The processing has failed

  • Pending : The processing is still going on

response_json

String

JSON string containing the list of all detected faces with or without mask.

logs

String

Indicates server logs of any error encountered.

image

String

Url of the input image

output_image

String

Url of the output image

owner

Integer

Unique ID of the user who created the request.

Request URL

https://api.skylarklabs.ai/face-mask-video/

Request parameters

None

Request headers

None

Request body

  • form-data

KEY

VALUE

DESCRIPTION

video

video file ( jpg, png )

The video that needs to be processed.

key

String (eg. 3bf26a02418194389aeec614e9df6c0eba0c439a6fe3f4590d4f11be24a76d0b)

The API Key generated against a project

Response 403 ( Forbidden )
{
    "detail": "provide a valid api key"
}
JSON

Response 200 ( Success )
{
    "id": 95,
    "created_at": "2020-07-17T18:56:44.289424Z",
    "updated_at": "2020-07-17T18:56:44.289464Z",
    "status": "pending",
    "response_json": null,
    "logs": null,
    "video": "http://api.skylarklabs.ai/media/face_mask/e322262dd16046ea9b246933a9530c60.mp4",
    "output_video": null,
    "percent_completed": 0.0,
    "owner": 1
}
CODE

KEY

TYPE

DESCRIPTION

id

Integer

Unique ID of the request, created by face-mask API.

created_at

String

Date and Time of the moment the request was created.

updated_at

String

Date and Time of the moment the request was updated.

status

String

Indicates status of the request, can take values [ ‘success’, ‘failed’, ‘pending’].

  • Success : The processing is completed

  • Failed : The processing has failed

  • Pending : The processing is still going on

response_json

String

JSON string containing the list of all detected faces with or without mask.

logs

String

Indicates server logs of any error encountered.

video

String

Url of the input video

output_video

String

Url of the output video

percent_completed

Float

Indicates completion of the processing in percentage format.

owner

Integer

Unique ID of the user who created the request.

Code Samples

cURL command for making a post request

curl --location --request POST 'http://localhost:9000/face-mask/' \
--form 'image=@filename.jpeg' \
--form 'key=1ca8344ceee1be11b9a450ec91a16100931999851970907892280b3247647'
PHP

HTTP Method GET

Request URL

https://api.skylarklabs.ai/face-mask/ { id }

“This API takes id of the post request made as parameter in the url”

Request Params

KEY

VALUE

Description

key

String (eg. 3bf26a02418194389aeec614e9df6c0eba0c439a6fe3f4590d4f11be24a76d0b)

The API Key generated against a project

Request body

None

Response 403 ( Forbidden )
{
    "detail": "provide a valid api key"
}
JSON

Response 200 ( Success )
{
    "id": 707,
    "created_at": "2020-07-17T18:15:55.559486Z",
    "updated_at": "2020-07-17T18:15:55.844413Z",
    "status": "success",
    "response_json": "[{\"has_mask\": false, \"coordinates\": {\"left\": 97, \"top\": 54, \"right\": 247, \"bottom\": 248}}]",
    "logs": null,
    "image": "http://api.skylarklabs.ai/media/face_mask/8a19471f83464643bb0a85368911cb21.jpg",
    "output_image": "http://api.skylarklabs.ai/media/face_mask/e5c16916-ce62-4950-8a9c-a8ee02657d65.jpg",
    "owner": 1
}
JSON

KEY

TYPE

DESCRIPTION

id

Integer

Unique ID of the request, created by face-mask API.

created_at

String

Date and Time of the moment the request was created.

updated_at

String

Date and Time of the moment the request was updated.

status

String

Indicates status of the request, can take values [ ‘success’, ‘failed’, ‘pending’].

  • Success : The processing is completed

  • Failed : The processing has failed

  • Pending : The processing is still going on

response_json

String

JSON string containing the list of all detected faces with or without mask.

Attributes :

  • has_mask : [true , false], indicates whether the face detected has a mask or not

  • coordinates : JSON object with coordinates of the rectangle formed.

logs

String

Indicates server logs of any error encountered.

image

String

Url of the input image

output_image

String

Url of the output image

owner

Integer

Unique ID of the user who created the request.

Code Samples

cURL command for making a get request

curl --location --request GET 'http://localhost:9000/face-mask/{id}/?
key=1ca8344ceee1be11b9a450ec91a16100931999851970907892210b3247647' 
PHP