Invariant patch distances and clustering
This package includes methods for clustering patches and reconstructing images using invariant patch distances. The package is build upon the CUDA C++ project: invariant_patch_distances. The package has the following dependencies: an NVIDIA graphics card of compute capability 3.x or higher, CUDA 10.0 and CMake 3.10.
Example
The following example shows how to cluster patches and reconstruct an image using these clusters.
import patchdistances as pd
# Load image as Float32 numpy array. It can either be gray-scale or rgb.
img = load_image()
// Initialize the distance class.
// Alternatively: similarity_inv_dist.
aid = pd.affine_inv_dist()
// Greedy-k-center clustering of the image patches using the distance.
labels, indices_of_labels = aid.greedy_k_center(
image=img,
patch_shape=(7,7),
clusters=20,
first_patch_idx=0,
solver=pd.solver_t.procrustes,
func_family=pd.func_t.superlevelsets,
use_imed=False,
interpolation=pd.inter_t.bicubic,
)
// Reconstruct the image using the previously clustered patches.
// Alternatively: reconstruct_w_translation.
reconstructed_image, nearest_neighbor_labeling = aid.reconstruct(
image=img,
labels=labels,
rec_type=pd.rec_t.Median,
solver=pd.solver_t.procrustes,
func_family=pd.func_t.superlevelsets,
use_imed=False,
interpolation=pd.inter_t.bicubic,
)
Metadata
Release files for patchdistances 1.0
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 |
|---|---|---|---|---|
| patchdistances-1.0.tar.gz | 553.3 kB | Without provenance | Details for patchdistances-1.0.tar.gz |
Release files / patchdistances-1.0.tar.gz
| Download URL | patchdistances-1.0.tar.gz |
|---|---|
| Size | 553.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b3a43570dfcc53e41fa5045954c2a43f5665e94eb792ae52d8fccab3f7446b8
|
|
BLAKE2b-256 checksum How to use checksums |
7d690182a510562ad7d81dac0711fe9b24847bc52513f435411193373f98d902
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2
|
Security for patchdistances 1.0
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.