enczoo: easily extract image features from pretrained vision models
enczoo is a Python library with a simple goal: to make it as easy as possible to map images (as PIL.Images) to features (as numpy arrays) from state-of-the-art vision models, such as Imagenet-pretrained ResNet50 and CLIP ViT-B/16.
Installation
enczoo requires Python 3.12 or above, and is installed using the wonderful uv project manager. Once you have uv installed, just run the following command in your project:
uv add enczoo
Usage
import enczoo
from PIL import Image
image = Image.open('my-image.png')
model = enczoo.ResNet50(
layer_name='avgpool',
# device=gpu
)
features = model.compute_features(images=[image]) # np.ndarray
# Want another layer? Check out: print(enczoo.ResNet50.layer_names)
Available models
Pixels
- Family: raw pixels
- Returns: float32 RGB pixels after preprocessing
- Output shape:
[B, 224, 224, 3] - Academic reference: none; this is an
enczooconvenience encoder
AlexNet
- Family: ImageNet-pretrained CNN
- Returns: intermediate activations from the requested layer
- Output shape: depends on
layer_name - Layer selection: inspect
enczoo.AlexNet.layer_names - Academic reference: AlexNet, "ImageNet Classification with Deep Convolutional Neural Networks" (Krizhevsky et al., 2012)
ResNet50
- Family: ImageNet-pretrained CNN
- Returns: intermediate activations from the requested layer
- Output shape: depends on
layer_name - Layer selection: inspect
enczoo.ResNet50.layer_names - Academic reference: ResNet, "Deep Residual Learning for Image Recognition" (He et al., 2015)
RobustResNet50
- Family: adversarially robust ImageNet ResNet-50
- Returns: intermediate activations from the requested layer
- Output shape: depends on
layer_name - Layer selection: inspect
enczoo.RobustResNet50.layer_names - Weights: downloaded on first use from the released ImageNet L2 epsilon-3.0 checkpoint
- Academic reference: Engstrom et al., "Robustness (Python Library)" release checkpoint via the MadryLab model weights
ConvNeXtB
- Family: ImageNet-pretrained CNN
- Returns: intermediate activations from the requested layer
- Output shape: depends on
layer_name - Layer selection: inspect
enczoo.ConvNeXtB.layer_names - Academic reference: ConvNeXt, "A ConvNet for the 2020s" (Liu et al., 2022)
CLIPResNet50
- Family: CLIP ResNet visual encoder
- Returns: intermediate activations from the requested visual layer
- Output shape: depends on
layer_name - Layer selection: inspect
enczoo.CLIPResNet50.layer_names - Academic reference: CLIP, "Learning Transferable Visual Models From Natural Language Supervision" (Radford et al., 2021)
CLIPViTB16
- Family: CLIP vision transformer
- Returns: the model's pooled CLS-based image embedding
- Output shape:
[B, 768] - Academic reference: CLIP, "Learning Transferable Visual Models From Natural Language Supervision" (Radford et al., 2021)
DINOv2ViTB14
- Family: self-supervised vision transformer
- Returns: the model's pooled CLS-based image embedding
- Output shape:
[B, 768] - Academic reference: DINOv2, "DINOv2: Learning Robust Visual Features without Supervision" (Oquab et al., 2023)
AligNetViTB16
- Family: AlignNet-aligned vision transformer
- Returns: the SavedModel feature tensor selected from the exported
pre_logitsoutput - Output shape: depends on the downloaded model
- Weights: downloaded on first use and cached under
ENCZOO_CACHE_DIRor the platform cache directory - Academic reference: Muttenthaler et al. 2025; weights come from the AlignNet model release
UnaligNetViTB16
- Family: unaligned vision transformer from the AlignNet release
- Returns: the SavedModel feature tensor selected from the exported
pre_logitsoutput - Output shape: depends on the downloaded model
- Weights: downloaded on first use and cached under
ENCZOO_CACHE_DIRor the platform cache directory - Academic reference: Muttenthaler et al. 2025; weights come from the AlignNet model release
Why develop enczoo?
Under the hood, enczoo solves several tiny problems which make correctly computing image features more annoying and error-prone than it should be. For example, enczoo automatically:
- performs model-specific image transforms ("was it -1 to 1, 0 to 1, or 0-255...?"),
- ensures images are in RGB format
- puts the model in inference, not training, mode
- turns off autograd
- returns tensors as
np.ndarray(no moredetach().cpu().numpy()) - resizes the image while preserving aspect ratio
- and more!
Metadata
Release files for enczoo 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| enczoo-0.1.5.tar.gz | 1.4 MB | Without provenance | Details for enczoo-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| enczoo-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for enczoo-0.1.5-py3-none-any.whl |
Total release size: 2.8 MB
Release files / enczoo-0.1.5.tar.gz
| Download URL | enczoo-0.1.5.tar.gz |
|---|---|
| Size | 1.4 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c64ae762d91afdc8cad65fb36453b08665216c64d9b8a0bd568b218e3e0cef8c
|
|
BLAKE2b-256 checksum How to use checksums |
3c94d481c7e15796cea6854152b678be64366532e8b6bc7f59410dc08b9759aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.12
|
Release files / enczoo-0.1.5-py3-none-any.whl
| Download URL | enczoo-0.1.5-py3-none-any.whl |
|---|---|
| Size | 1.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9f31cce8545ef7f5fa094f4b74b2b1f31240d6cb1c146ed4ab58778b16065cc0
|
|
BLAKE2b-256 checksum How to use checksums |
0acb8747b06e4ea8d689c5a470e7566a5691d93f763d5bc2e84fc1b6f19667bd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.12
|
Security for enczoo 0.1.5
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.