Milk powder box code recapture detection

Updated at:

1. Overview

This service uses a multimodal large model to audit photos from channel inspections. It performs recapture detection and localizes milk powder products, outer cartons, and box codes. The service returns a conclusion—non-recapture, recapture, or suspected recapture—and provides structured data for auditing and manual review.

2. Use cases

  1. Audit box code photos: Check images of milk powder outer cartons uploaded from channels or stores for recapture risks.

  2. Inspect milk powder displays: Locate individual milk powder products, full cartons, and clear code areas in a photo.

  3. Review suspected samples: Filter images requiring manual review based on their suspected status, algorithm score, and bounding boxes.

3. Features

  1. Three-state recapture assessment: The photoStatus field returns 0 for non-recapture, 1 for recapture, and 2 for suspected recapture. The response also includes the isFake, isSuspect, and score fields.

  2. Subject and code area localization: The service prioritizes locating individual milk powder products and outer cartons, and identifies clear box code labels, barcodes, and QR codes. It can still locate the main subject even when no codes are visible.

  3. Result coordination: Element localization supplements the recapture detection result without changing the conclusion. The service does not decode QR code content or perform product authenticity verification.

The service supports a single HTTPS image URL as input. The supplemental localization returns up to 12 target objects. Each object includes a category, a bounding box, and up to 24 characters of visible text. The coverage field indicates whether the localization is complete.

4. Development

For the public endpoint URL, authentication method, and gateway wrappers, refer to the official API documentation.

4.1 Request parameters

Parameter

Type

Required

Description

imageUrl

String

Yes

The HTTPS URL of the image to analyze. The URL must be publicly accessible, resolve to a valid image, have a width and height greater than 0, and not contain spaces or user credentials (username/password).

4.2 Request example

{
  "imageUrl": "https://example.com/images/api-01.jpg"
}

The example image URL and any knowledge base identifiers are placeholders. Replace them with your actual resources when making an API call.

4.3 Response parameters

General fields:

Field path

Type

Description

success

Boolean

Indicates whether the API call executed successfully. A true value does not indicate the outcome of the recapture check (e.g., that the image is a non-recapture).

errorCode

String

An empty string on success. Returns an error code on failure.

errorMessage

String

An empty string on success. Returns a specific error message on failure.

result

Object

The business result object. An empty object on failure.

usageMap

Object

Returns {"ProcessingCount":1} on success. Returns an empty object on failure.

usageMap.ProcessingCount

Integer

Indicates one successful processing count (the value is always 1). This field is omitted on failure.

Business fields:

Field path

Type

Description

result.type

String

Always returns the value boxCode.

result.photoStatus

Integer

0: non-recapture; 1: recapture; 2: suspected recapture.

result.isFake

Boolean

Returns true if photoStatus is 1 (recapture); otherwise, false.

result.isSuspect

Boolean

Returns true if photoStatus is 2 (suspected recapture); otherwise, false.

result.score

Number

A confidence score from the recognition service. A score of 0 is valid, and you do not need to apply an additional threshold for evaluation. The value range for this score is not specified.

Supplemental localization fields:

Field path

Type

Description

result.grounding

Object

Contains the supplementary element localization results.

result.grounding.coverage

String

complete: All relevant targets in the image were located. partial: Only some targets were valid or recognizable.

result.grounding.regions

Array

An array of up to 12 target objects. Can be empty if no relevant objects are found.

| result.grounding.regions[].label | String | The target category. See the table below for enumerated values. |

| result.grounding.regions[].bbox_2d | Integer[4] | An array of four integers: [top-left-x, top-left-y, bottom-right-x, bottom-right-y]. Values are normalized to a 0–1000 scale. The top-left coordinates must be less than their corresponding bottom-right coordinates. |

| result.grounding.regions[].text | String | Recognized text from the target, up to 24 characters. Returns an empty string if the text is illegible. |

Target categories:

Label

Description

milk_powder

Milk powder product

milk_powder_carton

Milk powder outer carton

box_code

Box code label area

barcode

Barcode area

qr_code

QR code area

To convert coordinates to pixel values: Pixel X = (X coordinate × Image Width) / 1000; Pixel Y = (Y coordinate × Image Height) / 1000.

A successful call (success: true) can return incomplete localization results, indicated by coverage: 'partial'. The coverage is also set to 'partial' if results are truncated. In such cases, only valid objects are returned. Even if localization fails or finds no objects, the API still returns the primary recapture detection result with success: true and is billed as one successful processing count. However, the entire call fails if a preliminary step, such as image validation or the primary recapture detection, fails.

4.4 Response examples

The following examples illustrate the response structure and are not based on actual test data.

1) Successful response

{
  "success": true,
  "errorCode": "",
  "errorMessage": "",
  "result": {
    "type": "boxCode",
    "isFake": false,
    "photoStatus": 0,
    "score": 0.93,
    "isSuspect": false,
    "grounding": {
      "coverage": "complete",
      "regions": [
        {
          "label": "milk_powder",
          "bbox_2d": [
            100,
            200,
            300,
            400
          ],
          "text": "Milk Powder"
        }
      ]
    }
  },
  "usageMap": {
    "ProcessingCount": 1
  }
}

2) Response with partial localization results

{
  "success": true,
  "errorCode": "",
  "errorMessage": "",
  "result": {
    "type": "boxCode",
    "isFake": false,
    "photoStatus": 0,
    "score": 0.93,
    "isSuspect": false,
    "grounding": {
      "coverage": "partial",
      "regions": [
        {
          "label": "milk_powder",
          "bbox_2d": [
            100,
            200,
            300,
            400
          ],
          "text": ""
        }
      ]
    }
  },
  "usageMap": {
    "ProcessingCount": 1
  }
}

Response for a suspected recapture

A suspected recapture is a valid business result, so success remains true.

{
  "success": true,
  "errorCode": "",
  "errorMessage": "",
  "result": {
    "type": "boxCode",
    "isFake": false,
    "photoStatus": 2,
    "score": 0.62,
    "isSuspect": true,
    "grounding": {
      "coverage": "complete",
      "regions": [
        {
          "label": "milk_powder",
          "bbox_2d": [
            100,
            200,
            300,
            400
          ],
          "text": "Milk Powder"
        }
      ]
    }
  },
  "usageMap": {
    "ProcessingCount": 1
  }
}

Successful recapture detection with no valid localization results

{
  "success": true,
  "errorCode": "",
  "errorMessage": "",
  "result": {
    "type": "boxCode",
    "isFake": false,
    "photoStatus": 0,
    "score": 0.93,
    "isSuspect": false,
    "grounding": {
      "coverage": "partial",

      "regions": [ ]

    }
  },
  "usageMap": {
    "ProcessingCount": 1
  }
}

Response for a parameter error

{
  "success": false,
  "errorCode": "InvalidParameter",
  "errorMessage": "The imageUrl must be a valid HTTPS image URL",
  "usageMap": {},
  "result": {}
}

Response for a processing failure

{
  "success": false,
  "errorCode": "DownstreamUnavailable",
  "errorMessage": "Failed to get a valid recapture detection result",
  "usageMap": {},
  "result": {}
}

4.5 Error codes

Error code

Description

Recommendation

InvalidParameter

The input is invalid, or the recognition service explicitly returned a business error.

Correct the parameters or business input based on the errorMessage and retry the call.

DownstreamUnavailable

A processing exception occurred, such as an issue with authentication, throttling, timeout, an empty response, missing fields, or parsing errors.

Check the resource and service status based on the errorMessage. You can retry the call if the failure is temporary.

You should determine the result based on the success, errorCode, and errorMessage fields. The source setup documentation does not specify the HTTP status codes for each type of business error. For platform-level common error codes, see Error Codes. The workflow error codes for this API are specified in the table above.

5. Billing

Metering is based on the successful processing count: a successful operation returns usageMap={"ProcessingCount":1}, while a failed operation returns usageMap={}. The specific unit price is to be confirmed and is subject to the official product pricing or the contract. The source documentation does not provide the unit price.

A call is billed as one successful processing count if it returns a valid business conclusion (such as recapture or suspected recapture), even if localization results are partial.