FeatureScope Python Library.
Project description
🫧 FeatureScope: Image Feature Visualization
https://github.com/user-attachments/assets/d14add7f-7124-4bd7-b960-313e480738c3
👆🏼 Jellyfish dataset from Kaggle; features extracted with DinoV2 and projected using PCA. You can download this example and try it yourself!
The FeatureScope helps you understand how numerical features are distributed in an image dataset.
- Choose which features to plot in X and Y in the 2D interactive plane.
- Explore the data interactively by zooming in an out and viewing images.
Image features can be any numerical values associated with images, such as measurements, embedding values, or numerical outputs from image analysis algorithms.
All data remains local. The images are only uploaded to your web browser's internal storage.
[!NOTE] Looking for the initial project, Spheriscope? You can find it on the spheriscope branch. However, we're not planning to develop this project further at the moment as we think the featurescope is applicable more broadly and easier to use.
Installation
You can install the featurescope Python package using pip:
pip install featurescope
or clone this repository and install the development version:
git clone https://github.com/MalloryWittwer/featurescope.git
cd featurescope
pip install -e python
Usage
Image Dataset
- Your images should be in
PNG,JPEGorTIFFformat. - They should be located in the same folder.
For example:
images/
├── img1.png
├── img2.png
├── ...
Featurizer
You should define a featurizer function in Python. This function will be applied to all images in the dataset in order to extract the features.
Constraints
- The featurizer function must take an
imageNumPy array a its first input. - The function must return a Python dictionary of numerical image features.
For example:
def minmax_featurizer(image: np.ndarray) -> Dict:
image_min = image.max()
image_max = image.max()
return {
"min": image_min,
"max": image_max
}
Computing Features
Use apply_featurizer to compute the features for all images in your dataset. The results are aggregated and saved as a CSV file named dataset.csv in the images folder.
from featurescope import apply_featurizer
apply_featurizer(minmax_featurizer, images_dir="/path/to/images")
Running apply_featurizer will loop over all image files in images_dir to load the images and compute the features. At the end of the process, the results are saved as dataset.csv:
images/
├── img1.png
├── img2.png
├── ...
├── dataset.csv <- Contains the computed features
Visualization
With your dataset.csv in the images folder, you can now drag and drop this folder into the front-end app for visualization.
- In a web browser, navigate to https://mallorywittwer.github.io/featurescope/.
- Load the folder containing the images and the
dataset.csvfile by dropping it into the drag-and-drop area.
That's it! You should now be able to browse and visualize your images and features. 🎉
Does the data remain local?
Yes! Your images remain local (they are not uploaded to a remote server) even if you access the front-end app via a public URL. Your images and features are simply uploaded to your web browser's internal storage. If you reload the page, everything should be cleaned up and reset!
License
This software is distributed under the terms of the BSD-3 license.
Issues
If you encounter any problems, please file an issue along with a detailed description.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file featurescope-0.0.2.tar.gz.
File metadata
- Download URL: featurescope-0.0.2.tar.gz
- Upload date:
- Size: 6.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28ebd1f0fdc3311fc1631271c538fe89798de716dba715893824e3836978f1c6
|
|
| MD5 |
9e8a4b1b63f64f81395f794a8d44b03d
|
|
| BLAKE2b-256 |
9d82570e8454cba0d55ce59710e9df4576bcc3f399f6d9a225c114c1b31a4067
|
File details
Details for the file featurescope-0.0.2-py3-none-any.whl.
File metadata
- Download URL: featurescope-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6578236e905666d07df80c8aac9fc3b9b17258fffb433b53ac9f07a14b099234
|
|
| MD5 |
f15d5018622f644db961a72aa05292e9
|
|
| BLAKE2b-256 |
fa9700e1ada10fd1be73599c1967a873f3f203f7c3427a5cf7ea5345ba6ff7d2
|