Image classification
Warning
The Vision OCR features listed below are legacy features discontinued on May 14, 2024.
This section describes how the image classification feature works.
Use this feature to find out how well an image matches a certain property (for instance, whether the image contains adult content). This can reduce the cost of manual moderation because you will be able to ban such images automatically.
The list of properties the result is returned for depends on the selected model. For example, the quality
model, which is used to assess the quality of an image, returns the probabilities for the low
, medium
, and high
properties. You can find more information about the supported models here.
Request format
To use this feature, specify CLASSIFICATION
in the feature type and provide the model name:
{
"folderId": "b1gvmob95yys********",
"analyze_specs": [{
"content": "iVBORw0KGgo...",
"features": [{
"type": "CLASSIFICATION",
"classificationConfig": {
"model": "quality"
}
}]
}]
}
Only one model can be used within a single analysis feature. If you need to apply more models to your image, provide another object in features
:
{
"folderId": "b1gvmob95yys********",
"analyze_specs": [{
"content": "iVBORw0KGgo...",
"features": [{
"type": "CLASSIFICATION",
"classificationConfig": {
"model": "quality"
}
},
{
"type": "CLASSIFICATION",
"classificationConfig": {
"model": "moderation"
}
}]
}]
}
Service response
The service returns a list of properties in the following format:
{
"name": "low", // Property name.
"probability": 0.71257284 // Probability of matching the property.
}
The service returns all properties for the selected model, even if the probability for a property is zero.
Response example:
{
"results": [{
"results": [{
"faceDetection": {
"properties": [{
"name": "low",
"probability": 0.001466292142868043
},
{
"name": "medium",
"probability": 0.003421348333358767
},
{
"name": "high",
"probability": 0.99511235952377319
}
]
}
}]
}]
}