# Same Product Image Matcher (`quarrylane/same-product-image-matcher`) Actor

- **URL**: https://apify.com/quarrylane/same-product-image-matcher.md
- **Developed by:** [QuarryLane](https://apify.com/quarrylane) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 candidate scoreds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Same Product Image Matcher

**Is this the same product?** Give the photos of your product and a list of candidate
listings (for example the results of a 1688, AliExpress, Alibaba or Amazon scraper run).
The Actor compares every photo of your product with every photo of each candidate, scores
them, ranks the candidates and flags the likely matches.

Built for sourcing (finding the supplier of a product), price monitoring (matching your
products to other shops' listings when titles differ) and spotting copies.

### What you get

One row per candidate:

| Field | Meaning |
|---|---|
| `queryId`, `candidateId` | Your product and the candidate (your IDs, or the dataset's `url`) |
| `rank` | 1 = the candidate most like your product |
| `score` | Similarity of the best-matching pair of photos, 0 to 1 |
| `verdict` | `likely_same` (score ≥ 0.90), `possible` (0.80–0.90), `different` (below 0.80), or `no_usable_photos` |
| `queryImage`, `candidateImage` | The two photos that matched best, to check by eye |
| `imageErrors` | Photos that couldn't be downloaded or read |
| `candidate` | The candidate exactly as you gave it (every field of the dataset item) |

**Embed mode** instead returns a 768-number vector for each image, to build your own
product search.

### How well it works

Measured on 300 products from Amazon Berkeley Objects, comparing two sets of photos of the
same product that share no photo:

- among lookalike products of the same type from other brands, the right product ranks
  first **89%** of the time;
- at a score of 0.90, it finds 60% of true matches while under 2% of other-brand lookalikes
  pass.

On real eBay sellers' photos (Stanford Online Products, 119 products in 12 categories), the
right product ranks first among its category **97%** of the time, and at 0.90 it finds 69%
of true matches with 0.5% false matches.

**Limits, plainly:**

- It compares **photos only**. The same model in another colour, size or pack size usually
  looks the same and scores like a match: check titles or prices for those.
- Two different sellers photographing the same product in different styles (a 1688 studio
  shot against an Amazon listing) is untested and likely scores lower than the figures
  above. The eBay test is easier: both photo sets of a product come from the same seller,
  and the rivals are random products of the category rather than lookalikes.
- More photos per listing (different angles) match much better than one photo each.
- It is for product photos. Don't use it to match people's faces.

This is the off-the-shelf version of the model; a version trained for product matching may
follow.

### Input

**Option 1, JSON:** `queries`, a list of your products, each with `images` (up to 8 photo
URLs) and `candidates` (each with `id` and `images`). Up to 200 candidates per product.

**Option 2, a dataset:** `datasetId` (for example a scraper run's default dataset) plus
`queryImages` (your product's photos). The Actor reads the photo URLs from the fields named
in `imageFields` (default: `images`, `imageUrls`, `imageUrl`, `image`, `thumbnail`,
`mainImage`; dots for nested fields).

### Pricing

Pay per event: one **candidate scored**, or one **image embedded**. Candidates with no usable
photo are not charged. When you reach your spending limit, the Actor stops working on the
rest (it doesn't score candidates it can't charge for) and says how many it skipped.

### Credits

Accuracy figures use Amazon Berkeley Objects (CC BY 4.0, © Amazon.com) and Stanford Online
Products (Song et al., "Deep Metric Learning via Lifted Structured Feature Embedding",
CVPR 2016; eBay sellers' photos, used for evaluation only). The model is
Google's SigLIP 2 (`google/siglip2-base-patch16-224`, Apache-2.0).

# Actor input Schema

## `mode` (type: `string`):

Match compares each query product with its candidates. Embed returns a 768-number vector per image for your own search index.

## `queries` (type: `array`):

Each item: your product (id, images: up to 8 photo URLs) and the candidate listings to check (candidates: each with id and images). Every field you give a candidate is kept in the output. Up to 200 candidates per product.

## `datasetId` (type: `string`):

ID of a dataset whose items are candidate listings, e.g. the results of a 1688, AliExpress or Amazon scraper run. All of them are compared with the photos below.

## `queryImages` (type: `array`):

Photo URLs of your product, compared with every item of the dataset. Several photos from different angles match better than one.

## `queryId` (type: `string`):

Copied to every output row as queryId.

## `imageFields` (type: `array`):

Fields of each dataset item that hold photo URLs (a URL or a list of URLs; dots for nested fields, e.g. media.mainImage). Default: images, imageUrls, imageUrl, image, thumbnail, mainImage.

## `idField` (type: `string`):

Field copied to each row as candidateId. Default: url (the item's position when missing).

## `maxCandidates` (type: `integer`):

Stop after this many candidates for each product (at most 200).

## `images` (type: `array`):

Photo URLs, up to 1,000 per run. Used only in Embed mode.

## Actor input object example

```json
{
  "mode": "verify",
  "queries": [
    {
      "id": "my-product",
      "images": [
        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/53/532b842a.jpg",
        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e1/e1f75d5e.jpg",
        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/8d/8df1d1bd.jpg"
      ],
      "candidates": [
        {
          "id": "listing-1",
          "images": [
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/c2/c2bcae85.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e7/e741428e.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/10/108b403e.jpg"
          ]
        },
        {
          "id": "listing-2",
          "images": [
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/a5/a5bcfc10.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e5/e55fc448.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/91/91663234.jpg"
          ]
        },
        {
          "id": "listing-3",
          "images": [
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/94/94117e0b.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/2d/2d8b3122.jpg"
          ]
        }
      ]
    }
  ],
  "maxCandidates": 200
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "queries": [
        {
            "id": "my-product",
            "images": [
                "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/53/532b842a.jpg",
                "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e1/e1f75d5e.jpg",
                "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/8d/8df1d1bd.jpg"
            ],
            "candidates": [
                {
                    "id": "listing-1",
                    "images": [
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/c2/c2bcae85.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e7/e741428e.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/10/108b403e.jpg"
                    ]
                },
                {
                    "id": "listing-2",
                    "images": [
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/a5/a5bcfc10.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e5/e55fc448.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/91/91663234.jpg"
                    ]
                },
                {
                    "id": "listing-3",
                    "images": [
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/94/94117e0b.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/2d/2d8b3122.jpg"
                    ]
                }
            ]
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("quarrylane/same-product-image-matcher").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "queries": [{
            "id": "my-product",
            "images": [
                "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/53/532b842a.jpg",
                "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e1/e1f75d5e.jpg",
                "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/8d/8df1d1bd.jpg",
            ],
            "candidates": [
                {
                    "id": "listing-1",
                    "images": [
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/c2/c2bcae85.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e7/e741428e.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/10/108b403e.jpg",
                    ],
                },
                {
                    "id": "listing-2",
                    "images": [
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/a5/a5bcfc10.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e5/e55fc448.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/91/91663234.jpg",
                    ],
                },
                {
                    "id": "listing-3",
                    "images": [
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/94/94117e0b.jpg",
                        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/2d/2d8b3122.jpg",
                    ],
                },
            ],
        }] }

# Run the Actor and wait for it to finish
run = client.actor("quarrylane/same-product-image-matcher").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "queries": [
    {
      "id": "my-product",
      "images": [
        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/53/532b842a.jpg",
        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e1/e1f75d5e.jpg",
        "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/8d/8df1d1bd.jpg"
      ],
      "candidates": [
        {
          "id": "listing-1",
          "images": [
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/c2/c2bcae85.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e7/e741428e.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/10/108b403e.jpg"
          ]
        },
        {
          "id": "listing-2",
          "images": [
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/a5/a5bcfc10.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/e5/e55fc448.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/91/91663234.jpg"
          ]
        },
        {
          "id": "listing-3",
          "images": [
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/94/94117e0b.jpg",
            "https://amazon-berkeley-objects.s3.amazonaws.com/images/small/2d/2d8b3122.jpg"
          ]
        }
      ]
    }
  ]
}' |
apify call quarrylane/same-product-image-matcher --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,quarrylane/same-product-image-matcher"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/0Hgeq5eIP4F9JtCsi/builds/tFVnxXl8dXUjGdAw9/openapi.json
