Spectral Hashing

Y. Weiss, A. Torralba, R. Fergus.
Advances in Neural Information Processing Systems, 2008.

PDF | Matlab Code


% Example of compression of a dataset stored in the matrix X = [Nsamples, Ndimensions]
% SHparam contains the compression parameters

% Toy dataset
Nsamples = 1000;
Ndimensions = 2;
X = rand(Nsamples, Ndimensions);

% Ttraining
SHparam.nbits = 10;
SHparam = trainSH(X, SHparam);

% Compress dataset: B = [Nsamples, ceil(Nbits/8)]
B = compressSH(X, SHparam);

% Compute distances: Dhamm = [Nsamples, Nsamples]
Dhamm = hammingDist(B, B);


Funding for this research was provided by NSF Career award (IIS 0747120), NGA NEGI- 1582-04-0004, Shell Research and ONR MURI Grant N00014- 06-1-0734.