API
FPT.AI Reader - Vietnamese Driving Licence Recognition
Requirements
- The input image must have 4 clear angles or all main components of a Vietnamese Driving Licence such as photocard, document title.
- All information fields must be visible, readable, unmodified, not blurred.
- The input image size does not exceed 5 MB and the minimum resolution is approximately 800x600 to ensure the confident rate.
- The ratio of Vietnamese Driving Licence area must be at least ¼ of the total image area.
Standard image
Bad image
- Image with low quality and lack of corner
- Image with low quality and lack of information
Request
Request Url
POST https://api.fpt.ai/vision/dlr/vnm
Request Headers
Parameter | Required | Default | Description |
---|---|---|---|
api_key | Yes | Your api key ( get from console.fpt.ai ) |
Request Body
FormData contain a single image to recognize
Tham số | Required | Description |
---|---|---|
image | Yes |
Sample Request
curl -X POST https://api.fpt.ai/vision/dlr/vnm -H "api-key: xxxxxx" -F "image=@path/to/image"
Response
JSON
{
"errorCode": x,
"errorMessage": "xxxx",
"data": [xxxx]
}
The system is able to extract all information found on old or new types of Vietnamese Driving Licence. The system divides the results into 3 categories: old Vietnamese Driving Licence front/back side and new Vietnamese Driving Licence front side.
After successfully sending the request, the system will return a json file that includes text information on the Vietnamese Driving Licence using the format below.
- errorCode: value is 0 if the request was successful with no error occurred
- errorMessage: value is equal to empty string if the request was successful with no error occurred
- data: include all information on the Vietnamese Driving Licence image if the request succeeds without errors, return empty list [] if an error occurs (All fields that the system can not extract, will have value "N/A"). Also included with the information extracted is the probability that indicates the reliability of the returned results. (The detail of the errors that might occure include both errorCode and errorMessage is described on Errors)
Old type - front side
{
"errorCode": 0,
"errorMessage": "",
"data": [{
"id": "xxxx",
"id_prob": "xxxx",
"name": "xxxx",
"name_prob": "xxxx",
"dob": "xxxx",
"dob_prob": "xxxx",
"nation": "xxxx",
"nation_prob": "xxxx",
"address": "xxxx",
"address_prob": "xxxx",
"place_issue": "xxxx",
"place_issue_prob": "xxxx",
"date": "xxxx",
"date_prob": "xxxx",
"doe": "xxxx",
"doe_prob": "xxxx",
"code": "xxxx",
"code_prob": "xxxx"
"type": "xxxx"
}]
}
The old type Vietnamese Driving Licence front side composes of 9 data fields:
Field | Description |
---|---|
id | Driving Licence number |
name | Name |
dob | Date of birth |
nation | Nationality |
address | Address |
place_issue | Place of issue |
date | Date of issue |
doe | Expiry date |
code | Code |
"_prob" fields are probability fields
Old type - back side
{
"errorCode": 0,
"errorMessage": "",
"data": [{
"class": [
"xxxx"
],
"class_prob": [
"xxxx"
],
"date": [
"xxxx"
],
"date_prob": [
"xxxx"
]
"type": "xxxx"
}]
}
The old type Vietnamese Driving Licence back side composes of 2 data fields:
Field | Description |
---|---|
class | Driving Licence class |
date | Date of issue |
New type - front side
{
"errorCode": 0,
"errorMessage": "",
"data": [{
"id": "xxxx",
"id_prob": "xxxx",
"name": "xxxx",
"name_prob": "xxxx",
"dob": "xxxx",
"dob_prob": "xxxx",
"nation": "xxxx",
"nation_prob": "xxxx",
"address": "xxxx",
"address_prob": "xxxx",
"place_issue": "xxxx",
"place_issue_prob": "xxxx",
"date": "xxxx",
"date_prob": "xxxx",
"class": "xxxx",
"class_prob": "xxxx",
"doe": "xxxx",
"doe_prob": "xxxx"
"type": "xxxx"
}]
}
The new type Vietnamese Driving Licence front side composes of 9 data fields:
Field | Description |
---|---|
id | Driving Licence number |
name | Name |
dob | Date of birth |
nation | Nationality |
address | Address |
place_issue | Place of issue |
date | Date of issue |
doe | Expiry date |
class | Driving number class |
New type - back side
{
"errorCode": 0,
"errorMessage": "",
"data": [{
"type": "xxxx"
}]
}
The system returns the document type:
- type - Document type
Errors
This section covers common errors and can be handled by the system, messages are returned clearly and specifically for the purpose of instructing users to use the API accurately. The system uses the error codes as follows:
Error Code | Meaning |
---|---|
0 | No error -- This is a successful call, no error |
1 | Invalid Parameters or Values! -- Wrong parameter in the request (e.g.no key or image in the request body). |
2 | Failed in cropping -- The Vietnamese Driving Licence in the image is missing of corners so it cannot be cropped to the standard format. |
3 | Unable to find Driving Licence in the image --The system cannot find the Vietnamese Driving Licence in the image or the image is of poor quality (too blur, too dark/bright). |
5 | No URL in the request -- The request uses the image_url key but the value is left blank. |
6 | Failed to open the URL! -- The request uses the image_url key but the system cannot open this URL. |
7 | Invalid image file -- The uploaded file is not an image file. |
8 | Bad data -- The uploaded image file is corrupted or the format is not supported. |