I’m a computer-vision researcher who frequently examines feature maps (such as PCA-to-RGB and cosine similarity) to validate the learning of a model. However, the challenge was that each backbone model resided in different locations, such as torch.hub, timm, HuggingFace, or some paper’s repository. Consequently, I had to rewrite the same glue code repeatedly to extract dense features from each model.
FeatLens addresses this issue by separating the “load the model” step from the “visualize it” step. An adapter layer normalizes any of these sources (including your own nn.Module and CNNs) into a single [B, L, D, h, w] tensor. The visualization side then arranges a model x layer grid. Coloring methods available include PCA, cosine similarity to a seed patch, k-means, foreground, saliency, and attention-rollout. Additionally, it supports cross-image patch correspondence, batch/folder mode, and video, including V-JEPA, where the entire clip is fed once and split into per-timestep maps.
To install FeatLens, simply run the following command in your terminal: pip install featlens.
To be transparent about prior art, PCA-on-DINO is a well-known technique. There are also related tools like dinotool (PCA extraction, primarily for one model at a time), FeatUp (feature upsampling), and grad-cam/Captum/to a different category. However, what I sought and couldn’t find in a single place was the combination of multiple providers behind a single API, various coloring methods, and side-by-side model x layer comparison.
This project began as a weekend endeavor, with significant contributions from Claude. It is licensed under MIT. I welcome feedback and PRs, particularly regarding model coverage and any feature-coloring methods you would like to see implemented.
tkargin•1h ago
FeatLens addresses this issue by separating the “load the model” step from the “visualize it” step. An adapter layer normalizes any of these sources (including your own nn.Module and CNNs) into a single [B, L, D, h, w] tensor. The visualization side then arranges a model x layer grid. Coloring methods available include PCA, cosine similarity to a seed patch, k-means, foreground, saliency, and attention-rollout. Additionally, it supports cross-image patch correspondence, batch/folder mode, and video, including V-JEPA, where the entire clip is fed once and split into per-timestep maps.
To install FeatLens, simply run the following command in your terminal: pip install featlens.
For a live demo, visit the following link: https://huggingface.co/spaces/turhancan97/FeatLens-demo
For detailed documentation, refer to the following link: https://turhancan97.github.io/FeatLens/
To be transparent about prior art, PCA-on-DINO is a well-known technique. There are also related tools like dinotool (PCA extraction, primarily for one model at a time), FeatUp (feature upsampling), and grad-cam/Captum/to a different category. However, what I sought and couldn’t find in a single place was the combination of multiple providers behind a single API, various coloring methods, and side-by-side model x layer comparison.
This project began as a weekend endeavor, with significant contributions from Claude. It is licensed under MIT. I welcome feedback and PRs, particularly regarding model coverage and any feature-coloring methods you would like to see implemented.