KNN (Left) vs NNK (Right) graph for different choices of K
As a consequence, we observe stable, sparse represetation where the relative position of the underlying data is taken into consideration. This property can be theoretically and geometrically explained using the Kernel Ratio Interval (KRI) as shown in the fig. below. Simply put, given a node j connected to i, NNK looks for additional neighbors that are in different directions i.e., orthogonal.
This geometric interpretation along with the pixel position regularity in images and specific characteristics of kernel allows us to learn image graphs in a fast and efficient manner (10x faster than naive NNK).
NNK image graph algorithm
We will use the bilateral filter kernel to construct the image graph, though any kernel that has values in range [0, 1] can be integrated into the NNK image graph framework. As shown in the paper, the bilateral filter with KRI gives us a simple threshold condition (computed offline) on intensity to determine if a pixel k is to be connected given a connected pixel j is connected to the center pixel. We will apply this condition with positive threshold going radially outwards from the center pixel, starting with the four connected neighbors. We confine ourselves to positive thresholds since negative thresholds corresponds to pixels in the opposite side of the pixel window and are less likely to be affected by the connectivity of the current pixel.
The figure below presents the case of NNK image graph algorithm for a 7x7 window centered at pixel i. Note that, conventionally one would connect i to all pixels in the window. In NNK, we start with one of the closest pixel namely j and assume its connected. We observe intensity differences and compare with the precomputed threshold to prune pixels that will not be connected given the connection to j. We perform this step iteratively i.e.,
Select closest pixel that is not pruned and connect to i
Apply pruning condition to remove pixels that are below threshold
Stop when no more pixels are left for processing
Experimental analysis
NNK image graphs have far fewer edges compared to its naive KNN-like counterparts (90% reduction in edges for a 11x11 window). This massive reduction in number of edges speeds up graph filtering operations in images by atleast 15x without loss in representation. Infact, we show that graph processing and transforms based on NNK image graphs are much better in capturing image content and resulting filtering performance.
Further, spectral image denoising based on NNK graphs shows promising performance. We observe that unlike BF graph based denoising whose performance worsens compared to its original non-graph based denoiser, NNK image graph based filtering improves performance achieving metrics close to more complex methods such as BM3D.
Future Directions
In this article, we looked at a scalable, efficient graph construction framework for images with interpretable connectivity and robust performance. Further, the local nature of the algorithm allows for parallelized execution. We believe we are only scratching the surface with bilateral filter kernels and that better performance and representation is possible by incorporating more complex kernels such as non local means, BM3D to name a few.
When we think about Multi-Layer Perceptrons (MLPs), we often visualize them as interconnected neurons processing information. However, there’s an elegant alternative perspective - viewing MLPs as hashing functions that partition input space and mapping functions on these partitions. Read more
At Tenyx, we’ve delved into the intricate workings of Large Language Models (LLMs) to uncover the geometric structures underlying their reasoning capabilities. Our research provides new insights into how LLMs process information and the implications for improving their reasoning abilities. Read more