Skip to main content

iconoscope

iconoscope is a python package for creating an image dataset with extracting features using vision or multimodal models including DINOv2/3 and CLIP. An image dataset with embeddings can be used to generate a static mosaic where visually similar images are placed near each other, or for exploration of similar images in a notebook.

The name iconoscope comes from the Greek words for image (εἰκών) and to see (σκοπεῖν). The iconoscope "was the first practical video camera tube to be used in early television cameras" (Wikipedia). Fun fact: the photosensitive system within the iconoscope was referred to as a "mosaic"!

iconoscope diagram brightly colored iconoscope displaying a grid of images, with sparks and networks coming out the sides. black and white logo based on iconoscope diagram.

From left to right: iconoscope diagram from Wikipedia; Logo image generated by Gemini (prompt: icon for a software library to visualize images based on embeddings; inspired by iconoscope video tube); my attempt at a black and white logo based on the diagram and letters.

Install

Install with pip, uv, or similar.

pip install "iconoscope[all]"

The base package only reads and writes image datasets (create, info, and loading stored data in Python), with minimal dependencies (h5py, numpy, pillow, polars). It can be used in WASM/Pyodide environments such as marimo notebooks running in the browser. Other commands need optional dependencies:

extra commands installs
embed embed torch, torchvision, transformers, accelerate
analysis umap, cluster, mosaic umap-learn, scikit-learn, scipy, lap
all everything both of the above

For example, pip install "iconoscope[analysis]" to generate mosaics from a dataset that already has embeddings.

Usage

iconoscope functionality is currently command-line only. The typical workflow is:

  • create an image dataset based on a directory of images (may be nested); saves an HDF5 file
  • embed those images with one or more models and save the features
  • Generate a mosaic from model embeddings (automatically generates umap coordinates)
  • You can optionally generate umap coordinates or cluster assignments.

Run iconoscope info to get a report of the data included in a dataset.

Run iconoscope <command> --help to see available options for each command.

create

Create an image inventory by discovering and validating local images. This step does not load an embedding model.

iconoscope create path/to/images/ my_collection.h5

iconoscope will search for image files anywhere within the specified image directory. Supported image extensions (case-insensitive) are .jpg, .jpeg, .png, .tiff, .webp, and .avif. Use --limit N to include at most N images (an arbitrary subset).

embed

Extract features with a pre-trained image model and save them to an existing dataset:

iconoscope embed my_collection.h5
iconoscope embed my_collection.h5 --model siglip --center-crop 60 --grayscale

Available models (-m/--model):

name Hugging Face model
dinov2 facebook/dinov2-base (default)
dinov3 facebook/dinov3-vitb16-pretrain-lvd1689m
resnet microsoft/resnet-50
siglip google/siglip-base-patch16-224
clip openai/clip-vit-base-patch32

Preprocessing options:

  • --center-crop CROP: square center crop retaining CROP percent (0–100] of the shortest edge; replaces the model's default resize/crop
  • --grayscale: convert images to grayscale before embedding

Each model + preprocessing combination is stored in the dataset under a separate configuration, labeled model/key (e.g. dinov2/defaults, siglip/center_crop=0.6_grayscale), so multiple configurations can coexist in one dataset. If features for a configuration already exist, embed does nothing unless -u/--update is given; updating replaces previously saved features and removes any UMAP or cluster results associated with the previous features.

If an image becomes unreadable after the inventory is created, embedding skips it. When adding the first configuration, the skipped image is removed from the dataset's shared image inventory so paths and feature rows remain aligned. Once any features have been saved, images cannot be removed because that would invalidate existing rows; embedding reports an error instead.

Selecting stored features

Commands that use stored features (mosaic, cluster, umap) select a configuration either with the same --model / preprocessing options used for embed, or with -c/--config MODEL/KEY (as shown by info); the two cannot be combined. If neither is given and the dataset has only one configuration, that one is used; otherwise the default model (dinov2) with default preprocessing is used.

umap

Calculate and save 2D UMAP coordinates for stored features. With no model or configuration specified, UMAP is calculated for all stored configurations; --config can be repeated. Existing coordinates are kept unless -u/--update is given.

iconoscope umap my_collection.h5
iconoscope umap my_collection.h5 -c dinov2/defaults -c clip/defaults --update

UMAP is not run with a fixed seed, so results vary between runs; saving them lets mosaics and notebooks reuse the same layout.

mosaic

Generate a mosaic image where visually similar images appear near each other:

iconoscope mosaic my_collection.h5
iconoscope mosaic my_collection.h5 -m clip --size 3000x1500 -o clip_mosaic.png

If UMAP coordinates for the selected embeddings are generated and saved if not yet available. The mosaic grid is determined by the output size and number of images, and is optimized for the most frequent image aspect ratio in the dataset. Images are slotted into the grid based on UMAP coordinates. Images are scaled and center-cropped to fill their grid cell.

Options:

  • -o/--output: output path (default: dataset name with .jpg, e.g. my_collection.jpg)
  • -s/--size: output size, a single number for a square or WIDTHxHEIGHT (default: 2000)
  • --jpeg-quality: 1–100, for JPEG output only
  • -l/--limit N: use at most N images

If the canvas is too small for the number of images, the error message suggests a --limit or --size that would work.

Example output

Here is an example of an image generated by iconoscope mosaic; this mosaic generated from 1000 images from Princeton Geniza Project fragments, based on feature embeddings from SigLIP with a center crop of 60%.

mosaic of 1000 Princeton Geniza Project fragment images

cluster

Cluster stored features with k-means and save the labels to the dataset:

iconoscope cluster my_collection.h5 8

Prints the number of images per cluster. Results for different numbers of clusters are stored separately.

info

Report dataset contents: schema, number of images and source directory, most common image size and aspect ratio, and for each stored configuration the feature dimensions, UMAP coordinates, and cluster results. Example:

iconoscope info my_collection.h5
Details for my_collection.h5 :
  schema: iconoscope 0.2
  4,302 image paths from /path/to/images
	Most frequent image size:  1024x768
	Most frequent aspect ratio: 1.33
  dinov2/defaults extracted features (4302x768)
	umap coordinates (4302x2)
	4,302 cluster labels (kmeans, k=8)

Notebooks

The notebooks/ directory has marimo notebooks for exploring datasets: UMAP → grid animation, nearest neighbor comparison across models, and an experimental PGP image explorer. See notebooks/README.md for details and usage.

HDF5 file layout

iconoscope stores image paths, extracted features, and derived data (UMAP coordinates, cluster labels) in a single HDF5 file (schema version 0.2), organized per model and preprocessing configuration so multiple configurations can coexist in the same dataset. All datasets are gzip-compressed.

my_collection.h5                (attrs: schema="iconoscope", schema_version=0.2)
└─ image/                       (attrs: image_dir)
   ├─ paths                     # image file paths relative to image_dir, shape (N,)
   ├─ sizes                     # image width and height in pixels, shape (N, 2)
   └─ models/                   # [optional, added by `embed`]
      └─ dinov2/                # one group per model
         └─ defaults/           # one group per preprocessing configuration (key)
            │                   #   (attrs: model, model_id, and any set options,
            │                   #    e.g. center_crop, grayscale)
            ├─ features         # embedding vectors, shape (N, embed_dim)
            ├─ umap             # 2D UMAP coordinates, shape (N, 2) [optional, added by `umap`/`mosaic`]
            └─ clusters/        # [optional, added by `cluster`]
               └─ kmeans_8      # cluster label per image, shape (N,)
                                #   (attrs: method, n_clusters)

The configuration key is defaults when no custom preprocessing options are specified and model defaults are used. Otherwise, the key is based on the combined set of options, e.g. center_crop=0.6_grayscale (center_crop is stored as a fraction). Cluster datasets are named {method}_{n_clusters}; kmeans is currently the only supported method.

image_dir is stored as an absolute path when the dataset is created, and image paths are stored relative to it; iconoscope combines them when loading, so a dataset can be used from any working directory. If the image directory moves, the image_dir attribute will need to be updated. All datasets in image/ and under each configuration share the same row order: row i is the same image everywhere. Image order is fixed once any features are stored.

iconoscope validates the file type, schema and schema_version attributes, and required image/ contents when opening a dataset; files from other schema versions are rejected.

Acknowledgments

Version 0.1 of this package was a vibe-coded prototype which started as a python port of Andrej Karpathy's CNN embedding visualizer created with ClaudeCode.

Version 0.2 is a complete rewrite. Development has been supported by AI coding tools, primarily OpenCode and Anthropic models; see commit history for specifics.

License

Apache 2.0

Metadata

Release files for iconoscope 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iconoscope 0.2.1
File Size Uploaded Provenance Actions
iconoscope-0.2.1.tar.gz 34.7 kB Without provenance Details for iconoscope-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iconoscope 0.2.1
File Interpreter ABI Platform Actions
iconoscope-0.2.1-py3-none-any.whl Python 3 none any Details for iconoscope-0.2.1-py3-none-any.whl

Total release size: 74.4 kB

Release files / iconoscope-0.2.1.tar.gz

Download URL iconoscope-0.2.1.tar.gz
Size 34.7 kB
Tags Source
SHA-256 checksum
How to use checksums
938cba4459e2faade93aa8f9d05dc15b4eeb7d72479d432bd7a89bc501de6b2b
BLAKE2b-256 checksum
How to use checksums
0481dea641d92820d49f821b6bf6fd711b6d8a22fa52380ef39cd5ba2dcc4925
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / iconoscope-0.2.1-py3-none-any.whl

Download URL iconoscope-0.2.1-py3-none-any.whl
Size 39.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9411a17d1150a3fc4b826f5af2d9a9b1de4f9eff0e865b3ebb45c8268ce6468e
BLAKE2b-256 checksum
How to use checksums
a097bde08c9001b927d3745cfbffb97078ebdf4c261f45bc5038800dc87deeaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for iconoscope 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page