License plate recognition
License plate recognition is a special case of using the detect method - the method allows you to find various objects in a photograph.
This method allows you to find various objects in the photograph.
Inquiry
Authorization data is passed in the query string:
Parameter |
A type |
Value |
oauth_token |
string |
OAuth2 access token (required non-empty) |
oauth_provider |
string |
OAuth2 provider (required non-empty) |
Supported OAuth2 providers:
ISP |
Oauth_provider value |
Getting a token |
Mail.Ru |
mr |
|
MCS | mcs |
https://mcs.mail.ru/help/vision-auth/vision-token (all MCS clients) |
Request parameters are passed in JSON format in the request body with name = "meta":
Parameter |
A type |
Value |
mode |
[] string |
types of objects to search for in the transferred images (required non-empty) |
images |
[] image_meta |
metadata of uploaded images (required non-empty) |
Possible mode values:
Parameter |
Value |
object |
search for objects in the image |
scene |
search in the scene image |
car_number |
search the image for car numbers |
multiobject |
search the image for multi-objects - objects and the whole set of boxes of all found objects |
pedestrian |
look for people in the image (more accurately identifies the set of boxes of all people in the image) |
mode
mode can contain one or more modes. For instance:
"mode": ["object"] <- search only objects
"mode": ["scene"] <- search only scenes
"mode": ["object", "scene"] <- search for scenes and objects
image_meta
Parameter |
A type |
Value |
name |
string |
filenames to match files in request and response (required non-empty) |
Images are passed in the request body, the values of the name field must match those passed in images.
The maximum number of images in one request is 100. The maximum size of each image should not exceed 4MB.
Example request:
POST / api / v1 / objects / detect? Oauth_provider = mr & oauth_token = 123 HTTP / 1.1 |
Answer
Parameter |
A type |
Value |
status |
int |
200 if successful, otherwise the error description will be in the body |
body |
string | response |
response body |
response
Parameter |
A type |
Value |
scene_labels |
[] object |
array of responses for each file with scenes (may be missing) |
object_labels |
[] object |
array of responses for each file with objects (may be absent) |
car_number_labels |
[] object |
an array of responses for each file with machine numbers (may not be present) |
multiobject_labels |
[] object |
array of responses for each file with multiobjects (may be missing) |
pedestrian_labels |
[] object |
an array of responses for each file with people (may not be present) |
object
Parameter |
A type |
Value |
status |
enum |
execution result |
error |
string |
textual description of the error (optional) |
name |
string |
filename to match files in request and response |
labels |
[] label |
list of objects (tags) found in the image |
( only for pedestrian mode )
Parameter |
A type |
Value |
|
count_by_density |
int |
number of people in the frame, calculated using the density map |
|
Parameter |
Value |
||
0 |
successfully |
||
1 |
permanent error |
||
2 |
temporary error |
label
Parameter |
Value |
eng |
tag (name) for the found object in English |
rus |
tag (name) of the found object in Russian |
eng_categories |
list of categories (each category includes many tags) in English (optional) |
rus_categories |
list of categories (each category includes many tags) in Russian (optional) |
prob |
degree of confidence that this particular object is in the image |
coord |
coordinates of the found object (optional) |
types_prob |
an array of number plate types probabilities. the following types are currently supported: "rus" - all types of Russian numbers, "cis" - numbers of the CIS (except for individual and military Ukrainian ones), "eu" - one-story numbers of Europe ( optional, only for car_number mode ) |
Sample response:
{
"status": 200,
"body":
{
"object_labels": [
{
"status": 0,
"name": "file_0",
"labels": [
{
"eng": "Person",
"rus": "Man",
"eng_categories": [],
"rus_categories": [],
"prob": 0.6542,
"coord": [0,63,518,656]
},
{
"eng": "Face",
"rus": "Face",
"eng_categories": [],
"rus_categories": [],
"prob": 0.6841,
"coord": [0,63,518,571]
}
]
}
],
"scene_labels": [
{
"name": "file_0",
"status": 0,
"labels": [
{
"eng": "Beauty Salon",
"rus": "Beauty salon",
"eng_categories": [],
"rus_categories": [],
"prob": 0.3457
},
{
"eng": "Stage",
"rus": "Scene",
"eng_categories": ["Concerts"],
"rus_categories": ["Concerts"],
"prob": 0.2651
}
]
}
],
"car_number_labels": [
{
"name": "file_0",
"status": 0,
"labels": [
{
"eng": "C606KY777",
"rus": "S606KU777",
"prob": 0.9996,
"coord": [250,281,334,302],
"types_prob": [
{
"type": "ru",
"prob": 0.9820
},
{
"type": "cis",
"prob": 0.9367
},
{
"type": "eu",
"prob": 0.0026
}
]
},
{
"eng": "T820YO98",
"rus": "T820UO98",
"prob": 0.4563,
"coord": [250,281,334,302],
"types_prob": [
{
"type": "ru",
"prob": 0.9220
},
{
"type": "cis",
"prob": 0.9167
},
{
"type": "eu",
"prob": 0.0026
}
]
}
]
}
]
"multiobject_labels": [
{
"status": 0,
"name": "file_0",
"labels": [
{
"eng": "Person",
"rus": "Man",
"eng_categories": [],
"rus_categories": [],
"prob": 0.9765,
"coord": [308,107,1920,1153]
},
{
"eng": "Person",
"rus": "Man",
"eng_categories": [],
"rus_categories": [],
"prob": 0.9893,
"coord": [423,72,634,479]
}
]
}
],
"pedestrian_labels": [
{
"name": "file_0",
"status": 0,
"labels": [
{
"eng": "Pedestrian",
"rus": "Man",
"prob": 0.9996,
"coord": [150,221,278,402]
},
{
"eng": "Pedestrian",
"rus": "Man",
"prob": 0.9863,
"coord": [177,181,434,320]
}
],
"count_by_density": 5
}
]
},
"htmlencoded": false,
"last_modified": 0
}
An example of a response when one of the pictures was not processed:
{
"status": 200,
"body":
{
"object_labels": [
{
"status": 2,
"error": "internal error: image crc mismatch",
"name": "file_0"
},
{
"status": 0,
"name": "file_1",
"labels": [
{
"eng": "Person",
"rus": "Man",
"eng_categories": [],
"rus_categories": [],
"prob": 0.6542,
"coord": [0,63,518,656]
}
}
]
},
"htmlencoded": false,
"last_modified": 0
}
An example of a response when the request failed:
{
"status": 500,
"body": "Internal Server Error",
"htmlencoded": false,
"last_modified": 0
}]
Python example:
python
examples / python / smarty.py \
-u "https://smarty.mail.ru/api/v1/objects/detect?oauth_provider=mr&oauth_token=e50b000614a371ce99c01a80a4558d8ed93b313737363830" \
-p examples / friends1.jpg \
--meta '{"mode": ["scene"]}' \
-v