SLOSH: Set LOcality Sensitive Hashing via Sliced-Wasserstein Embeddings

Yuzhe Lu, Xinran Liu, Andrea Soltoggio, Soheil Kolouri

Abstract

Learning from set-structured data is an essential problem with many applications in machine learning and computer vision. This paper focuses on non-parametric and data-independent learning from set-structured data using approximate nearest neighbor (ANN) solutions, particularly locality-sensitive hashing. We consider the problem of set retrieval from an input set query. Such retrieval problem requires: 1) an efficient mechanism to calculate the distances/dissimilarities between sets, and 2) an appropriate data structure for fast nearest neighbor search. To that end, we propose Sliced-Wasserstein set embedding as a computationally efficient "set-2-vector" mechanism that enables downstream ANN, with theoretical guarantees. The set elements are treated as samples from an unknown underlying distribution, and the Sliced-Wasserstein distance is used to compare sets. We demonstrate the effectiveness of our algorithm, denoted as Set-LOcality Sensitive Hashing (SLOSH), on various set retrieval datasets and compare our proposed embedding with standard set embedding approaches, including Generalized Mean (GeM) embedding/pooling, Featurewise Sort Pooling (FSPool), and Covariance Pooling and show consistent improvement in retrieval results.

Introduction

In many real-world applications—from 3D object recognition to image retrieval—data is naturally represented as a set. Unlike standard vectors, sets have two tricky properties: they can have different cardinalities (number of elements), and they are permutation-invariant. Comparing two sets traditionally requires solving an "assignment problem" (like the Hungarian algorithm or Optimal Transport), which is computationally expensive—often $O(N^3)$ or $O(N^2)$ relative to the number of elements $N$. While "set-to-vector" pooling methods (like taking the mean or max) are fast, they often discard crucial structural information.

SLOSH (Set LOcality Sensitive Hashing) addresses this by leveraging Sliced-Wasserstein Embeddings (SWE). It maps complex sets into a vector space where Euclidean distance approximates the Sliced-Wasserstein distance, enabling the use of standard hashing techniques for efficient, large-scale retrieval.

Methodology: Sliced-Wasserstein Embeddings

The core of the SLOSH framework is the Sliced-Wasserstein Embedding (SWE). Instead of calculating the full Wasserstein distance, which is computationally prohibitive in high dimensions, the authors utilize the Sliced-Wasserstein (SW) distance. The SW distance projects high-dimensional distributions onto 1D lines (slices), where the Wasserstein distance becomes a simple sorting problem.

The SWE process follows these steps:

  1. Reference Set: A fixed reference set $X_0$ is selected.
  2. Slicing: Both the input set $X_i$ and the reference set $X_0$ are projected onto $L$ random unit vectors.
  3. Monge Coupling: For each direction, the projected points are sorted. The embedding for that slice is the difference between the sorted points of $X_i$ and $X_0$.
  4. Concatenation: These differences are concatenated across all $L$ slices to form a single high-dimensional vector $\phi(X_i) \in \mathbb{R}^{LM}$.
The SWE process: random projections and sorting lead to a final vector representation where $L_2$ distance approximates Sliced-Wasserstein distance.

The $L_2$ (Euclidean) distance between two such embeddings is mathematically equivalent to the Sliced-Wasserstein distance between the original sets. This property allows the application of standard Locality-Sensitive Hashing (LSH) to enable sub-linear time retrieval.

Experimental Evaluation

The authors evaluated SLOSH on three diverse set-retrieval tasks: Point Cloud MNIST 2D (60,000 samples), ModelNet40 (3D CAD models), and Oxford 5k (landmark images represented as sets of local features).

Key Results

SLOSH consistently outperformed standard data-independent baselines like Generalized Mean (GeM) pooling, Covariance pooling, and Featurewise Sort Pooling (FSPool). For instance, on Point MNIST, SLOSH achieved a precision of ~0.90, significantly higher than FSPool (~0.75). Qualitative results demonstrate that SLOSH successfully retrieves semantically similar objects even when point clouds vary in density and orientation.

Qualitative retrieval results across Point Cloud MNIST, ModelNet40, and Oxford 5k datasets. Green boxes indicate correct matches.

Furthermore, sensitivity analysis showed that increasing the number of slices ($L$) consistently improves retrieval performance by providing a better approximation of the full distribution.

Discussion and Conclusion

SLOSH provides a "set-2-vector" operator that preserves the geometry of underlying probability distributions, making it more descriptive than simple pooling methods. Its data-independent nature means it requires no training phase, and its $O(LN(d + \log N))$ complexity ensures scalability. While effective, the method's performance is somewhat sensitive to the choice of the reference set $X_0$, and the resulting embeddings can be high-dimensional. Future work may involve optimizing slices and reference sets in a data-dependent manner to further enhance performance.

Summary updated

Abstract

Learning from set-structured data is an essential problem with many applications in machine learning and computer vision. This paper focuses on non-parametric and data-independent learning from set-structured data using approximate nearest neighbor (ANN) solutions, particularly locality-sensitive hashing. We consider the problem of set retrieval from an input set query. Such retrieval problem requires: 1) an efficient mechanism to calculate the distances/dissimilarities between sets, and 2) an appropriate data structure for fast nearest neighbor search. To that end, we propose Sliced-Wasserstein set embedding as a computationally efficient "set-2-vector" mechanism that enables downstream ANN, with theoretical guarantees. The set elements are treated as samples from an unknown underlying distribution, and the Sliced-Wasserstein distance is used to compare sets. We demonstrate the effectiveness of our algorithm, denoted as Set-LOcality Sensitive Hashing (SLOSH), on various set retrieval datasets and compare our proposed embedding with standard set embedding approaches, including Generalized Mean (GeM) embedding/pooling, Featurewise Sort Pooling (FSPool), and Covariance Pooling and show consistent improvement in retrieval results. The code for replicating our results is available here: \href{https://github.com/mint-vu/SLOSH}{https://github.com/mint-vu/SLOSH}.
BibTeX
@inproceedings{lu2024slosh,
  author = {Yuzhe Lu and Xinran Liu and Andrea Soltoggio and Soheil Kolouri},
  title = {{SLOSH: Set LOcality Sensitive Hashing via Sliced-Wasserstein Embeddings}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00255},
}
Figure