An API for streamlining unsupervised ML ops such as visualizations, clustering, CNN insights, etc.
Project description
A collection of deep learning -- computer vision utility functions
Installation
pip install optical_toolkit
Visualize
- Visualize a dataset in a grid
from sklearn.datasets import load_digits
from optical_toolkit.visualize import plot_images
X, y = load_digits()
plot_images(X, targets=y)
- Summarize a dataset by classes
from sklearn.datasets import load_digits
from optical_toolkit.visualize import plot_images
X, y = load_digits()
summarize_images(X, targets=y, num_images_per_class=10, num_classes=10)
- Visualize the 2d and 3d embeddings of images
from sklearn.datasets import load_digits
from optical_toolkit.embeddings import get_embeddings
X, y = load_digits()
2d_embeddings, fig_2d = get_embeddings(X, y, dims=2, embedding_type="tsne", return_plot=True)
3d_embeddings, fig_3d = get_embeddings(X, y, dims=3, embedding_type="tsne", return_plot=True)
Insight
- Visualize the filters of a (trained) CNN model
from optical_toolkit.cnn_filters import display_filters, display_model_filters
model_name = "xception"
layer_names = [
"block2_sepconv1",
"block5_sepconv1",
"block9_sepconv1",
"block14_sepconv1",
]
for layer_name in layer_names:
display_filters(
model=model_name,
layer_name=layer_name,
)
display_model_filters(model=model_name)
- Visualize the filters of your custom CNN with custom objects
import keras
model_name = "examples/custom_models/svdnet.keras"
dir_name = "examples/insights"
@keras.saving.register_keras_serializable()
class ResidualConvBlock(keras.layers.Layer):
...
display_model_filters(
model_name,
custom_layer_prefix="residual",
)
Analyze
- Analyze 'highly confident' errors in classification tasks
- Confusion matrix normalized by row/column
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
optical_toolkit-1.3.0.tar.gz
(16.4 kB
view details)
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 optical_toolkit-1.3.0.tar.gz.
File metadata
- Download URL: optical_toolkit-1.3.0.tar.gz
- Upload date:
- Size: 16.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78689c0e577b1c3ba609a99458b4a267bf9850ef5f8e429bc9d225609e52299a
|
|
| MD5 |
bea66070c4f10573fb3518bc81ec2771
|
|
| BLAKE2b-256 |
031af7491cdc30394f660d98b0a7e0b8bd57be17b0febd943164992fe05407b7
|
File details
Details for the file optical_toolkit-1.3.0-py3-none-any.whl.
File metadata
- Download URL: optical_toolkit-1.3.0-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.10.16 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcfe93707dad60c9238719e6d9e20399434af8348edcdf28d92db51a0bd49aa2
|
|
| MD5 |
9d690f88cb19778601ed496c0f99f6ec
|
|
| BLAKE2b-256 |
63a0194af7e4cbbe93cb728291342b124f169ec292af004f69a74d2da88a05e1
|