Awesome Open Source
Awesome Open Source

Hashing with Mutual Information

This repository contains the MATLAB implementation of the following paper:

Hashing with Mutual Information,
Fatih Cakir*, Kun He*, Sarah Adel Bargal, and Stan Sclaroff. TPAMI 2019 (PDF, arXiv)

If you use this code in your research, please cite:

  author    = {Fatih Cakir and Kun He and Sarah Adel Bargal and Stan Sclaroff},
  title     = {Hashing with Mutual Information},
  booktitle = {IEEE Transactions on Pattern Analysis and Machine Intelligence},
  year      = {2019},

⚠️ The hbmp branch contains the implementation of the following paper:

Hashing with Binary Matrix Pursuit,
Fatih Cakir, Kun He, and Stan Sclaroff. ECCV 2018 (conference page, arXiv)

If you use this code in your research, please cite:

author = {Cakir, Fatih and He, Kun and Sclaroff, Stan},
title = {Hashing with Binary Matrix Pursuit},
booktitle = {The European Conference on Computer Vision (ECCV)},
year = {2018}


  • Install or symlink MatConvNet at ./matconvnet (for training CNNs)
  • Install or symlink VLFeat at ./vlfeat
  • Download necessary datasets to ./cachedir/data/ Note: Large file ~35GB
  • Download necessary model files to ./cachedir/models/
  • Create ./cachedir/results/ folder to hold experimental data
  • In the root folder, run startup.m

⚠️ Follow the setup instructions for HBMP in the hbmp branch.

Example Commands

  • The main functions for experimenting are demo_imagenet.m (for the ImageNet100 benchmark) and demo_AP.m (for other benchmarks such as CIFAR-10 and NUSWIDE).
  • The main arguments can be found in get_opts.m.
  • Below are examples commands to replicate some of the results in the paper. Please refer to Section 5 of the paper and get_opts.m for experimental setting and parameter details. A MATLAB diary will be saved to the corresponding experimental folder.
    • CIFAR-1 32 bits:
      • demo_AP('cifar',32,'vggf','split',1,'nbins',32,'sigmf', [1 0],'lr', 1e-3,'lrstep',50,'epoch',100,'obj','mi','testInterval',10, 'batchSize', 256, 'metrics', 'AP')
      • Diary. Achieves 0.78-0.79 mAP at 100 epochs.
    • CIFAR-2 32 bits:
      • demo_AP('cifar',32,'vggf','split',2,'nbins',12,'sigmf', [30 0],'lr', 2e-3,'lrstep',50,'epoch',100,'obj','mi','testInterval',10, 'batchSize', 256, 'metrics', 'AP')
      • Diary. Achieves 0.93-0.94 mAP at 100 epochs.
    • NUSWIDE-1 32 bits :
    • NUSWIDE-2 32 bits :
    • ImageNet100 48 bits:
      • demo_imagenet(48, 'alexnet_ft', 'split', 1 , 'nbins', 16, 'lr', 0.1, 'lrdecay', 0.05, 'lrmult', 0.01, 'lrstep', 100, 'nbins', 16, 'sigmf', [10 0], 'testInterval', 25, 'metrics', {'AP', '[email protected]'}, 'epoch', 125)
      • Diary. Achieves 0.68-0.69 [email protected] at 125 epochs.


MIT License, see LICENSE


For questions and comments, feel free to contact: [email protected]


  • This implementation extends MIHash, and is specifically designed for deep learning experiments. Special thanks to Kun and Sarah.

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
computer-vision (1,094
matlab (804
embeddings (76
image-retrieval (64
hashing (51
nearest-neighbor-search (24
eccv (15

Find Open Source By Browsing 7,000 Topics Across 59 Categories