Yandex.Cloud
  • Services
  • Why Yandex.Cloud
  • Pricing
  • Documentation
  • Contact us
Get started
Yandex Vision
  • Getting started
  • Step-by-step instructions
    • All instructions
    • Text recognition
    • Assessing image quality
    • Image moderation
    • Face detection
    • Base64 encoding
  • Concepts
    • Overview
    • Text recognition
      • Overview
      • Template recognition
      • Supported languages
      • Current version restrictions
    • Image classification
      • Overview
      • Supported models
    • Face detection
    • Quotas and limits
  • Access management
  • Pricing policy
  • API reference
    • Authentication in the API
    • gRPC
      • Обзор
      • VisionService
    • REST
      • Handling errors
      • Troubleshooting
      • Overview
      • Vision
        • Overview
        • batchAnalyze
  • Questions and answers
  1. Concepts
  2. Image classification
  3. Overview

Image classification

  • Request format
  • Service response

Image classification is currently in the Preview stage.

This section describes how the image classification feature works in the service.

Use this feature to find out how well an image matches a certain property (for instance, whether the image contains adult-only content). This can reduce the cost of manual moderation because you will be able to ban such images automatically.

The list of properties that 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 properties such as low, medium, and high. More information about supported models.

Request format

To use this feature, specify CLASSIFICATION in the feature type and pass the name of the model:

{
    "folderId": "b1gvmob95yysaplct532",
    "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, pass another object in features:

{
    "folderId": "b1gvmob95yysaplct532",
    "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.

Sample response:

{
  "results": [{
    "results": [{
      "faceDetection": {
        "properties": [{
            "name": "low",
            "probability": 0.001466292142868043
          },
          {
            "name": "medium",
            "probability": 0.003421348333358767
          },
          {
            "name": "high",
            "probability": 0.99511235952377319
          }
        ]
      }
    }]
  }]
}

What's next

  • View the list of supported models
  • See how to handle errors
In this article:
  • Request format
  • Service response
Language
Careers
Privacy policy
Terms of use
© 2021 Yandex.Cloud LLC