Using PIP Python Package

iApp Technology just released a PIP Python Package on Face Recognition System.

For easing the python development using iApp AI API service, we have released the iapp_ai python pip package. It is the api client library for iApp AI API service for python.

Installation

$ pip install iapp_ai

Note: It can be either pip or pip3 depend on your environment.

Calling Face Recognition API

# Face Recognition System required an image file path
# Single Face Recognition API
api.face_recog_single("iapp_ai/media/id-card-front.jpg", "iApp").json()
# Multiple Face Recognition API
api.face_recog_multi("iapp_ai/media/id-card-front.jpg", "iApp").json()
# Facecrop API
api.face_recog_facecrop("iapp_ai/media/id-card-front.jpg", "iApp").json()

Example Usages

import iapp_ai


# You can request API key at https://ai.iapp.co.th
apikey = 'XXXXX_Your_API_Key_XXXXX' 

api = iapp_ai.api(apikey)

# Face Recognition System required an image file path
# Single Face Recognition API
result = api.face_recog_single("iapp_ai/media/id-card-front.jpg", "iApp").json()
print(result)

# {
# 'bbox': {'xmax': 444.05816650390625,
# 'xmin': 396.0487976074219,
# 'ymax': 230.8387451171875,
# 'ymin': 171.31033325195312},
# 'company': 'iApp',
# 'detection_score': 0.99895179271698,
# 'message': 'successfully performed',
# 'name': 'unknown',
# 'process_time': 0.0913400650024414,
# 'recognition_score': 0.0
# }

# Multiple Face Recognition API
result = api.face_recog_multi("iapp_ai/media/id-card-front.jpg", "iApp").json()
print(result)

# { 
#   'message': 'successfully performed',
#  'process_time': 0.0861353874206543,
#  'result': [{'bbox': {'xmax': 444.05816650390625,
#     'xmin': 396.0487976074219,
#     'ymax': 230.8387451171875,
#     'ymin': 171.31033325195312},
#    'company': 'iApp',
#    'detection_score': 0.99895179271698,
#    'name': 'unknown',
#    'recognition_score': 0.0}]
#  }

# Facecrop Recognition API
result = api.face_recog_facecrop("iapp_ai/media/id-card-front.jpg", "iApp").json()
print(result)

# {
#   'company': 'iApp',
#  'message': 'successfully performed',
#  'name': 'unknown',
#  'process_time': 0.050871849060058594,
#  'recognition_score': 0.0
#  }

Full Example in Google Colaboratory

Last updated