Perform inference using the color classification model.

Recipes
🚀
Classify Product Colors using Inference API
Open Recipe
Access your API Key by Logging In
Login Login

Introduction and Purpose

Welcome to the Color Classification API! This API allows you to leverage the power of our AI model to perform accurate color classification on images. By providing the hex color labels for your product images, you can gain valuable insights into the color composition of your inventory. This information can help you make data-driven decisions for visual merchandising, trend analysis, and more.

Authentication

A Valid API Key will be required to be sent forward in the request using the header x-vody-api-key

Endpoint

This API endpoint allows you to perform color classification using our powerful AI model. You can submit a batch of images along with their corresponding product information, and our model will classify the colors based on the provided hex color labels.

Usage Example

Here's an example of how to use this API endpoint to perform color classification:

curl --request POST \
     --url https://prod-api.vody.com/inference/color-classification \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-vody-api-key: 1234abcd-1234-1234-abcd-1234abcd5678' \
     --data '
[
  {
    "image_path": "https://vody.com/images/playground/color-labels/0.png",
    "product_type": "Convertible Chair"
  },
  {
    "image_path": "https://vody.com/images/playground/color-labels/1.png",
    "product_type": "Tufted Armchair"
  }
]
'

Request

  • Method: POST
  • URL: https://prod-api.vody.com/inference/color-classification
  • Headers:
    • accept: application/json
    • x-vody-api-key: YOUR_API_KEY

Request Body

[
    {
      "image_path": "https://vody.com/images/playground/color-labels/0.png",
      "product_type": "Shoes",
      "hex_color_label": "#FE2934",
      "category": "Fashion"
    },
    {
      "image_path": "https://vody.com/images/playground/color-labels/1.png",
      "product_type": "Shoes",
      "hex_color_label": "#ED6F42",
      "category": "Fashion"
    },
    {
      "image_path": "https://vody.com/images/playground/color-labels/2.png",
      "product_type": "Shoes",
      "hex_color_label": "#1B1A1E",
      "category": "Fashion"
    }
]

Description

The request body should be an array of objects, where each object represents an image to be classified. It contains the following information:

  • image_path: The URL of the image to be classified.
  • product_type: The type of product associated with the image (e.g., "Shoes").
  • hex_color_label: The hex color label associated with the image (e.g., "#FE2934").
  • category: The category of the product (e.g., "Fashion").

Response

Upon successful processing of your request, the API will return a response in JSON format. The response will include the classification results for each image in the batch. Each result will contain information such as the image URL, product type, hex color label, and the classification output, which may include color names, color codes, or any other relevant color information extracted from the image.

An email report will be sent to you after the completion of the batch operation.

Successful Response (200)

{
  "message": "Message queued successfully on the inference queue for dev-api.vody.com",
  "inference_id": "1676dc31-b6d2-4878-9861-c75a54ff56c6",
  "model": "color-classification"
}

Error Response (400)

This error response indicates that the request body is invalid. The error message will provide more details about the issue with the request. Below is an example of an error response for an invalid request body that is missing image_path for one of the images.

{
  "error": "Bad Request",
  "message": "Invalid data. Index 34's value for image_path is missing",
  "code": 400
}

Supported Image URL Formats

The Color Classification API supports various image formats, including JPEG, PNG, WEBP, and GIF. You can submit images in these formats to the API for color classification. Ensure that your images are of high quality and well-optimized for accurate color analysis.

Validation and Error Handling

To ensure successful API requests, make sure to adhere to the following guidelines:

  • The request body must be in valid JSON format.
  • Each image object in the payload must contain a valid URL, product type, hex color label, and category.
  • The hex color label should be a valid hexadecimal color code (e.g., "#FF0000" for red).

In case of any errors, the API will respond with appropriate error codes and error messages indicating the issue with the request. Please refer to the API documentation for a list of possible error codes and their meanings.

Batch Processing

The Color Classification API supports batch processing, allowing you to submit multiple images in a single request. However, please note that there is a maximum limit (250) on the number of images that can be included in a batch. Ensure that your batch size does not exceed this limit to avoid processing errors or timeouts. If you have a large number of images to classify, it is recommended to split them into smaller batches and make parallel requests for efficient processing.

Rate Limiting

To ensure fair usage and maintain the API's performance, rate limiting policies are in place. These policies define the maximum number of requests that you can make within a specific time frame. If you exceed the allowed limit, the API will respond with a rate limit exceeded error. Please refer to the API documentation or contact our support team to learn more about the rate limits imposed by the Vody Inference API.

Best Practices

To make the most out of the Color Classification API, consider the following best practices:

  • Use high-quality images with good lighting conditions and minimal noise for accurate color analysis.
  • Ensure that the hex color labels provided align with the actual dominant colors in the images.
  • Organize your payload efficiently by grouping similar images together, which can improve processing speed and accuracy.
  • Regularly update your image dataset to keep up with changing trends and product offerings.
Language
Authorization
Header
URL
Click Try It! to start a request and see the response here!