Skip to main content

semsketch

Dense per-pixel image features from a classical filter bank and foundation models, as used by SemSketch's interactive segmentation, plus the classifiers it trains on them.

import torch
from semsketch import Embedder, available_models

# Classical features only: runs anywhere, including the CPU.
features = Embedder(classical=True)(torch.rand(2, 1, 256, 256))  # (2, 37, 256, 256)

# Foundation models (CUDA or Apple's MPS); weights download on first use.
print(available_models())
embedder = Embedder(classical=False, models=["diffusion/ssd1b", "sam3/neck12"])
features = embedder(images)  # (B, 640 + 320, H, W)

# Each source separately.
by_source = embedder.embed_sources(images)  # {"diffusion/ssd1b": ..., "sam3/neck12": ...}

# Each model reduced to its own number of PCA components; None keeps a model's raw channels.
embedder = Embedder(models={"diffusion/ssd1b": 32, "sam3/neck12": 16, "alibi-dinov3": None})
features = embedder(images)  # (B, 37 * image channels + 32 + 16 + 384, H, W)

A reduced model's PCA is fitted per image on its backbone grid, as SemSketch's segmenter fits it, so components are not comparable across images. Each reduced model is centered and scaled to unit mean variance, so the sources weigh equally in a classifier.

Images are (B, 1 or 3, H, W) tensors, float in [0, 1] or uint8; a single (C, H, W) or (H, W) image is treated as a batch of one. The output is (B, C, H, W) float32, the sources concatenated in embedder.sources order.

Models

  • classical: 37 channels per image channel (Gaussian, Sobel, Hessian and difference-of-Gaussians responses at several scales, and membrane projections).
  • diffusion/<unet>: Stable Diffusion UNet activations (ssd1b is SemSketch's default).
  • sam3/neck, sam3/neck12: SAM3 image-encoder features.
  • vulture/dinov2_vits14: Vulture's FeatUp-upsampled DINOv2. It needs tldr-group's Vulture, which PyPI does not carry: pip install https://github.com/tldr-group/vulture/archive/c3c728a326d99217bac6956c936af277a92bacda.tar.gz.
  • alibi-dinov3: SemSketch's ALiBi DINOv3 backbone.
  • Any DINOv3 or C-RADIO Hugging Face ID, or a local .pth backbone checkpoint.

Each model's grid is lifted bilinearly to every pixel; the features are the raw lifted channels, without the per-image PCA SemSketch's segmenter fits on them. OpenAI embeddings are not supported.

Downloads

Weights go to Hugging Face's cache (~/.cache/huggingface, or HF_HOME) unless Embedder(model_dir=...) or SEMSKETCH_MODEL_DIR names another folder. Gated models (SAM3, DINOv3) ask for a Hugging Face token when none is set (HF_TOKEN or hf auth login), and say where to accept their licence.

Licence

GPL-3.0-or-later. The models it downloads have their own licences; see THIRD_PARTY_NOTICES.md.

Metadata

Release files for semsketch 0.1.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 semsketch 0.1.1
File Size Uploaded Provenance Actions
semsketch-0.1.1.tar.gz 101.6 kB Without provenance Details for semsketch-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 216.9 kB

Release files / semsketch-0.1.1.tar.gz

Download URL semsketch-0.1.1.tar.gz
Size 101.6 kB
Tags Source
SHA-256 checksum
How to use checksums
62b852e4363f3b3c9a2da35697b12eb630ff50307089fce61423f0d920e755dc
BLAKE2b-256 checksum
How to use checksums
19e070d402b89910e395be008fece38b8f7af433c27c1f5526b961570b7cf6e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / semsketch-0.1.1-py3-none-any.whl

Download URL semsketch-0.1.1-py3-none-any.whl
Size 115.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d7d2fdcd871f6dfd94715b4a7828b0ee147f777eff53ff01ad41007ce3067e0d
BLAKE2b-256 checksum
How to use checksums
6594159887241340fe9b6be34f17d6e6809257bf640cd6ad87bc1723f33e0630
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for semsketch 0.1.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.1.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