This topic describes the details of the product comparison model, including the model features, input format, output format, and test data.

  • Overview

    The product comparison model adopts the ResNet50 backbone that integrates with advanced metric learning technology for images. This model can be used to compare and analyze various products, such as shoes, bags, and dresses. If you want to compare other categories of products,submit a ticket.

  • Input format
    The input data must be in the JSON format. It contains the following fields:
    {
        "function_name": "match",
        "function_params": {
            "imagea": "Base64-encoded image content",       
            "imageb": "Base64-encoded image content",       
            "metric":  "L2", #, or "Cosine"
            },
     }
    Field Required Description Type
    function_name Yes The name of the function. The function name of the product comparison model is match. STRING
    function_params imagea Yes The Base64-encoded string of the image. STRING
    imageb Yes The Base64-encoded string of the image. STRING
    metric Yes The method that is used to calculate the similarity between images. Valid values:
    • L2: the L2 norm distance.
    • Cosine: the cosine distance.
    STRING
  • Output format
    The output data is in the JSON format. The following table describes the fields in the output data.
    Field Description Shape Type
    request_id The unique ID of the request. [] STRING
    success Indicates whether the request is successful. Valid values:
    • true: indicates that the request succeeded.
    • false: indicates that the request failed.
    [] BOOL
    l2_distance The L2 norm distance between images. This field is returned when the metric field is set to L2.

    A value of 0 indicates that the two images are the same. The greater the value is, the more different the two images are.

    [] FLOAT
    cosine_similarity The cosine distance between images. This field is returned when the metric field is set to Cosine.

    A value of 1 indicates that the two images are the same. The smaller the value is, the more different the two images are.

    [] FLOAT
    The following code provides an example of the output data:
    {
        "request_id": "49f7da21-7e55-427d-a551-5952f104****", 
        "success": true, 
        "l2_distance": 0.4584488272666931
        #"cosine_similarity":0.8853877782821655
      }