Perform inference using the pattern classification model.
Introduction and Purpose
Welcome to the Pattern Classification API! This API allows you to leverage the power of our AI model to perform accurate pattern classification on images.
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 pattern 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 patterns based on the provided product_type labels.
Usage Example
Here's an example of how to use this API endpoint to perform pattern classification:
curl --request POST \
--url https://prod-api.vody.com/inference/pattern-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/pattern-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",
"category": "Fashion"
},
{
"image_path": "https://vody.com/images/playground/color-labels/1.png",
"product_type": "Shoes",
"category": "Fashion"
},
{
"image_path": "https://vody.com/images/playground/color-labels/2.png",
"product_type": "Shoes",
"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").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, category, and the classification output, which may include pattern names, probability, or any other relevant patterns that were 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": "pattern-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 Pattern Classification API supports various image formats, including JPEG, PNG, WEBP, and GIF. You can submit images in these formats to the API for pattern classification. Ensure that your images are of high quality and well-optimized for accurate pattern 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, and category (optional input).
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 Pattern Classification API supports batch processing, allowing you to submit multiple images in a single request. However, please note that there is a maximum limit (600000) 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 Pattern Classification API, consider the following best practices:
- Use high-quality images with good lighting conditions and minimal noise for accurate pattern analysis.
- 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.