Vision
Label images with a MobileNet model, returning the top ImageNet class or the top predictions with confidence scores
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/vision/index.md to help me query Vision with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Top-5 (label, confidence) predictions for an image BLOB, confidence-descending.
Example output · captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT label, round(confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB)
ORDER BY confidence DESC;
| label | confidence |
|---|---|
| envelope | 0.1352 |
| ping-pong ball | 0.0981 |
| Band Aid | 0.0729 |
| tennis ball | 0.0529 |
| binder | 0.0524 |
Quick start
Choose where to run Vision, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'vision' AS vision (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-vision-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'vision' AS vision (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-vision:0.5.0'
);
3. Run a query
SELECT label, round(confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB)
ORDER BY confidence DESC;
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'vision' AS vision
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT label, round(confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB)
ORDER BY confidence DESC;
Query Farm operates Vision for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use vision as the catalog alias for the query below.
4. Run a query
SELECT label, round(confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB)
ORDER BY confidence DESC;
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach with uvx
Needs uv. uvx builds the worker from its release tag on first attach and reuses the cached environment after that.
ATTACH 'vision' AS vision (
TYPE vgi,
LOCATION 'uvx --from git+https://github.com/Query-farm/[email protected] vgi-vision-worker'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'vision' AS vision (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-vision:0.5.0'
);
Overview
Image classification (ImageNet) on image blobs and file paths for SQL.

Run deep-learning image classification directly in DuckDB SQL — point a query at a column of image blobs (or image file paths) and get back ImageNet-1k labels, no Python notebook, model server, or ML pipeline required. The vision catalog turns computer-vision inference into ordinary SQL functions you can SELECT, filter, JOIN, and aggregate.
This extension is for data engineers, analysts, and application developers who want to tag, filter, search, or group images by what they depict without leaving the database. Classic use cases include auto-labeling a column of photo blobs, finding every row whose image looks like a cat or a car, ranking an image's most probable subjects, and enriching a media table with predicted categories — all expressed as the SQL you already write. Because the model runs out-of-process behind VGI, untrusted inputs are safe: a malformed, empty, or oversized image yields SQL NULL (scalar) or no rows (table function), never a worker crash.
Under the hood, inference is powered by ONNX Runtime, Microsoft's high-performance, cross-platform inference engine for ONNX models (source on GitHub, documentation). The classifier is a permissively-licensed MobileNetV2 model trained on the ImageNet 1000-class dataset (Apache-2.0 weights served via ONNX Runtime's MIT license) — deliberately chosen to be safe for a commercial marketplace, unlike copyleft alternatives. The model and its 1000 labels are downloaded once on first use and cached locally, so subsequent queries pay only inference cost.
How it works
There are two ways to ask the model about an image: a per-row scalar that returns the single most probable ImageNet label, ideal as an enrichment column, and a table function that returns the top-k (label, confidence) predictions in descending confidence. The model's full 1000-class label set is also published as a browsable table, so predicted labels can be validated or joined against the vocabulary the model actually knows.
Notes
Every image argument is accepted either as a BLOB column or via a filesystem-path overload. Untrusted or malformed images yield SQL NULL (scalar) or no rows (table), never a crash, making the functions safe to apply across an entire column of user-supplied data.
Catalog
Everything vision exposes once attached — read straight from the worker's
released build.
main 1 table · 2 functions
Image classification (ImageNet) on image blobs for SQL
Schema examples (7)
Single most likely ImageNet label for an image BLOB literal.
SELECT vision.main.top_label('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB) AS label;
Top-5 (label, confidence) predictions for an image BLOB literal, confidence-descending.
SELECT label, round(confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB)
ORDER BY confidence DESC;
| label | confidence |
|---|---|
| envelope | 0.1352 |
| ping-pong ball | 0.0981 |
| Band Aid | 0.0729 |
| tennis ball | 0.0529 |
| binder | 0.0524 |
Count the ImageNet classes the model can predict (1000).
SELECT count(*) AS n_classes FROM vision.main.image_classes();
Peek at the first five (idx, label) class rows.
SELECT idx, label
FROM vision.main.image_classes()
WHERE idx < 5
ORDER BY idx;
3 more examples
Join the top-10 predictions for an image BLOB to the image_classes lookup table to recover each predicted label's ImageNet class index (idx), most-confident first.
SELECT c.idx, p.label, round(p.confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB, 10) AS p
JOIN vision.main.image_classes AS c USING (label)
ORDER BY p.confidence DESC;
Roll the full 1000-class distribution for an image BLOB up to one coarse category: total probability on the 118 dog-breed classes (ImageNet idx 151-268, found via image_classes) and the most likely breed among them.
SELECT count(*) AS n_breeds, round(sum(p.confidence), 4) AS dog_probability,
arg_max(p.label, p.confidence) AS likeliest_breed
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB, 1000) AS p
JOIN vision.main.image_classes AS c USING (label)
WHERE c.idx BETWEEN 151 AND 268;
Tag images fetched with read_blob using top_label and look each label up in image_classes for its class index; a file that is not an image gets a NULL label, so the LEFT JOIN keeps it with NULL idx.
SELECT f.filename, c.idx, c.label
FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-vision/v0.4.0/test/sql/data/sample.png') AS f
LEFT JOIN vision.main.image_classes AS c ON c.label = vision.main.top_label(f.content)
ORDER BY f.filename;
image_classes
The model's ImageNet label set: (idx, label), 1000 rows
Count the ImageNet classes the model can predict (1000).
SELECT count(*) AS n FROM vision.main.image_classes;
Peek at the first five (idx, label) class rows.
SELECT idx, label FROM vision.main.image_classes WHERE idx < 5 ORDER BY idx;
SELECT count(*) AS n FROM vision.main.image_classes();
1 more example
SELECT idx, label
FROM vision.main.image_classes()
WHERE idx < 5
ORDER BY idx;
top_label (image BLOB) +1 overload
The #1 predicted ImageNet label for an image BLOB (NULL if not an image)
top_label(image BLOB) → VARCHARtop_label(path VARCHAR) → VARCHAR
Predict the single most likely ImageNet label for an image BLOB literal.
SELECT vision.main.top_label('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB) AS label;
Predict the top label for an image fetched over HTTPS with read_blob.
SELECT vision.main.top_label(content) AS label
FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-vision/v0.4.0/test/sql/data/sample.png');
Tag images fetched with read_blob using top_label and look each label up in image_classes for its class index; a file that is not an image gets a NULL label, so the LEFT JOIN keeps it with NULL idx.
SELECT f.filename, c.idx, c.label
FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-vision/v0.4.0/test/sql/data/sample.png') AS f
LEFT JOIN vision.main.image_classes AS c ON c.label = vision.main.top_label(f.content)
ORDER BY f.filename;
classify (image BLOB, top_k BIGINT) +3 overloads
Top-5 ImageNet predictions (label, confidence) for an image BLOB
classify(image BLOB)classify(image BLOB, top_k BIGINT)classify(path VARCHAR)classify(path VARCHAR, top_k BIGINT)
Top-5 predictions for an image BLOB literal, with rounded confidence, most-confident first.
SELECT label, round(confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB)
ORDER BY confidence DESC;
| label | confidence |
|---|---|
| envelope | 0.1352 |
| ping-pong ball | 0.0981 |
| Band Aid | 0.0729 |
| tennis ball | 0.0529 |
| binder | 0.0524 |
Join the top-10 predictions for an image BLOB to the image_classes lookup table to recover each predicted label's ImageNet class index (idx), most-confident first.
SELECT c.idx, p.label, round(p.confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB, 10) AS p
JOIN vision.main.image_classes AS c USING (label)
ORDER BY p.confidence DESC;
Roll the full 1000-class distribution for an image BLOB up to one coarse category: total probability on the 118 dog-breed classes (ImageNet idx 151-268, found via image_classes) and the most likely breed among them.
SELECT count(*) AS n_breeds, round(sum(p.confidence), 4) AS dog_probability,
arg_max(p.label, p.confidence) AS likeliest_breed
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB, 1000) AS p
JOIN vision.main.image_classes AS c USING (label)
WHERE c.idx BETWEEN 151 AND 268;
1 more example
Top-10 predictions for an image BLOB literal (explicit top_k), confidence-descending.
SELECT label, round(confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB, 10)
ORDER BY confidence DESC;
Try these queries
Predict the single most likely ImageNet label for an image BLOB.
SELECT vision.main.top_label('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB) AS label;
Uses top_label
Count the classes the model can predict (1000 ImageNet labels).
SELECT count(*) AS n FROM vision.main.image_classes();
Count the ImageNet classes the model can predict (1000).
SELECT count(*) AS n_classes FROM vision.main.image_classes()
Peek at the first five (idx, label) class rows.
SELECT idx, label
FROM vision.main.image_classes()
WHERE idx < 5
ORDER BY idx
Join the top-10 predictions for an image BLOB to the image_classes lookup table to recover each predicted label's ImageNet class index (idx), most-confident first.
SELECT c.idx, p.label, round(p.confidence, 4) AS confidence
FROM vision.main.classify('\x89\x50\x4E\x47\x0D\x0A\x1A\x0A\x00\x00\x00\x0D\x49\x48\x44\x52\x00\x00\x00\x40\x00\x00\x00\x40\x08\x02\x00\x00\x00\x25\x0B\xE6\x89\x00\x00\x00\xE1\x49\x44\x41\x54\x78\xDA\xED\xDA\xB1\x0D\x83\x30\x10\x85\x61\xB0\x18\x21\x43\x30\x4C\x26\xA0\x66\x04\xC6\xC8\x08\x29\x52\x65\x82\x0C\xC3\x10\x19\x22\x05\x4D\xA4\x20\x41\x7C\xCF\x1C\x27\xFF\x57\x02\xB2\xDE\x87\x8D\x31\x16\x6D\x3F\x3C\x9A\xC8\x95\x9A\xE0\x05\x00\x00\x00\x00\x00\x00\x00\xF0\xAC\x6E\xCF\x45\xAF\xE1\xEE\x95\xEF\xFA\x1C\x19\x42\x00\x00\x00\x00\xE0\xFD\x1E\xC8\xA8\x79\x7A\xFF\x1E\xEC\x6F\x97\x00\x80\xD5\xE8\xDF\xA7\xB4\x8C\xEE\x98\xE8\xE5\x18\xE9\xE0\xF4\xD9\xD7\x97\x05\xE4\xA5\x91\x18\x92\x57\x7A\x95\xA1\xFA\xF7\x80\xFD\x16\x1A\x5B\xA8\xBB\x07\x54\x33\x89\xA5\x1D\xD6\x42\x00\x00\x00\x08\x0C\x50\xAD\x28\x2D\xED\x54\x3F\x84\xEC\x9D\x60\x6C\x81\x87\xD8\x76\x0B\xED\x1D\x98\x1C\x9F\x42\xC9\x1C\x20\x1B\x42\xFF\xA6\x51\xCD\x60\xCA\x8F\xFA\x25\xD3\xE6\xD2\xF2\xBC\xBB\x12\x9B\x8C\x18\xFB\x42\xE5\xB2\x32\x8D\x02\x00\x00\x00\x80\xBE\x5A\x7E\xFA\x03\x00\x00\x00\x00\x00\x00\x00\xE4\xD7\x07\x2B\x8B\x39\x99\xCE\x48\xA8\x86\x00\x00\x00\x00\x49\x45\x4E\x44\xAE\x42\x60\x82'::BLOB, 10) AS p
JOIN vision.main.image_classes AS c USING (label)
ORDER BY p.confidence DESC
Tag images fetched with read_blob using top_label and look each label up in image_classes for its class index; a file that is not an image gets a NULL label, so the LEFT JOIN keeps it with NULL idx.
SELECT f.filename, c.idx, c.label
FROM read_blob('https://raw.githubusercontent.com/Query-farm/vgi-vision/v0.4.0/test/sql/data/sample.png') AS f
LEFT JOIN vision.main.image_classes AS c ON c.label = vision.main.top_label(f.content)
ORDER BY f.filename
5 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- How many rows does the model's ImageNet class listing return — i.e. the total number of (idx, label) entries in the full class list? Return that single number.
- What is the ImageNet class label at class index 0? Return the single label.
- List the three ImageNet classes with the smallest class index. Return columns `idx` and `label`, ordered by `idx` ascending.
Vision is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
Image
Documents & media
Decode images, read EXIF and GPS tags, spot near-duplicates by perceptual hash, and make thumbnails
Audio
Documents & media
Measure duration, tempo, loudness, spectral timbre, MFCCs and musical key of audio files with librosa
Barcode
Documents & media
Read barcodes and QR codes from images, identify their symbology, and generate new ones as PNGs