Size chart detection
Detects whether an input image is a size chart and returns a boolean result. This feature is based on a visual classification model and supports custom confidence thresholds. It is suitable for use as a pre-filter for Size Chart Extraction in a batch asset pipeline to reduce invalid billing. This is a synchronous call.
Overview and use cases
This API is a lightweight classifier that only answers the question, "Is this image a size chart?" Compared to the Size Chart Extraction API, this detection API is faster and less expensive but does not parse the content. The extraction API is slower and more expensive but returns structured data.
Typical use cases:
-
Batch asset ingestion: Product detail pages often contain 8 to 20 images, but only one or two are size charts. You can first use this API to scan all images, identify the size charts, and then send only those to the Size Chart Extraction API for processing.
-
Compliance check: Certain product categories, such as apparel, require that main product images do not contain size charts. You can batch-process main images and flag any that return
IsSizeChart=truefor review. -
Asset categorization: Add a
size-charttag to a large volume of product images to enable conditional rendering on the client side.
Endpoint
POST /rest/ai/sizeChart/detect
Quick start
A typical use case is batch filtering: call the detection API for each image in a product batch, identify the size charts, and then send only those images to the Size Chart Extraction API. This strategy helps you avoid paying to process non-size-chart images.
import json
# A batch of product detail images. A product usually has 8-20 images, with only 1-2 size charts.
image_urls = [
"https://example.com/detail-1.jpg",
"https://example.com/detail-2.jpg",
"https://example.com/detail-3.jpg",
]
size_chart_urls = []
for url in image_urls:
data = json.dumps({"ImageUrl": url, "Threshold": "0.4"})
res = make_signed_request("/rest/ai/sizeChart/detect", data)
# Synchronous response: Data.IsSizeChart is the boolean result.
if res["Data"]["IsSizeChart"]:
size_chart_urls.append(url)
print("Detected size charts:", size_chart_urls)
# Next, send the size_chart_urls in a batch to the Size Chart Extraction API for structured parsing.
For detailed instructions on request signing, Software Development Kit (SDK) examples in Java, Python, and Go, and an online debugging tool, see the Size Chart Detection API (OpenAPI Portal).
Request parameters
|
Parameter |
Type |
Required |
Description |
|
|
String |
Yes |
The URL of the image. Requirements: JPG, JPEG, PNG, BMP, or WEBP format; resolution between 256×256 and 3000×3000 pixels; a file size of 10 MB or less. |
|
|
String |
No |
The detection confidence threshold. The value can range from 0.0 to 1.0, with a default of |
Response fields
|
Field |
Type |
Description |
|
|
String |
The business status code. A value of |
|
|
String |
The response message. If the call is successful, this field returns |
|
|
Boolean |
Indicates whether the API call was successful. |
|
|
String |
The unique request ID. |
|
|
Boolean |
Indicates whether the image is a size chart: |
|
|
Number |
The number of images processed in this call, used for billing verification. |
Complete example
Request example
{
"ImageUrl": "https://img.alicdn.com/imgextra/i4/example.jpg",
"Threshold": "0.4"
}
Response example
{
"Code": "success",
"Message": "Success",
"Success": true,
"RequestId": "8b6ccc4c-9289-9a9e-bf1e-08aa88895505",
"Data": {
"IsSizeChart": false,
"UsageMap": { "ProcessedImageCount": 1 }
}
}
Recommendations
-
Threshold selection: The default threshold of 0.4 is suitable for most apparel scenarios. For categories with less conventional size charts, such as jewelry or footwear, we recommend starting with a threshold of 0.3 to increase recall, followed by manual review.
-
Extraction pipeline best practices: For optimal performance, make concurrent calls from your client to this API (default QPS is 5) to filter for images where
IsSizeChart=true. Then, asynchronously submit these images to the Size Chart Extraction API. This approach can typically reduce overall costs by 60% to 80%. -
Billing: Detection vs. Extraction: This API is billed per image based on
ProcessedImageCount, but the rate is significantly lower than that of the extraction API. For details, see the billing page.
Error codes
|
Error code |
Description |
|
|
The |
|
|
The input image triggered content moderation. |
|
|
The image failed to download, or the downstream classification model is unavailable. We recommend retrying the request with exponential backoff. |
|
|
The free trial quota has been exhausted. |
|
|
An internal server error occurred. Please save the |
For a complete list, see Error Codes.
Limitations
-
Call pattern: Synchronous. The default QPS is 5, with a request timeout of 30 seconds.
-
Input image: JPG, JPEG, PNG, BMP, or WEBP format; resolution between 256×256 and 3000×3000 pixels; file size of 10 MB or less. Only one image is supported per API call.
-
Billing: ¥0.01 per image, billed based on the
ProcessedImageCount. See Product Asset Optimization pricing for details.
FAQ
Next steps
-
After identifying an image as a size chart, use this API to extract its content as structured data — Size Chart Extraction.
-
The Pro workflow for apparel automatically chains detection, extraction, and attribute writing — Product Asset Optimization Pro.