Giter Site home page Giter Site logo

hcoh_pytorch's Introduction

Supervised Online Hashing via Hadamard Codebook Learning

论文Supervised Online Hashing via Hadamard Codebook Learning

Requirements

  1. pytorch 1.1
  2. loguru

Dataset

  1. CIFAR-10-vgg

Usage

python run.py --data-path <dataset-path> --num-hadamard 32 --lr 2e-4 --topk -1

日志记录在logs文件夹内

usage: run.py [-h] [--dataset DATASET] [--data-path DATA_PATH]
              [--num-hadamard NUM_HADAMARD] [--code-length CODE_LENGTH]
              [--num-query NUM_QUERY] [--num-train NUM_TRAIN] [--topk TOPK]
              [--lr LR] [--gpu GPU]

HCOH_PyTorch

optional arguments:
  -h, --help            show this help message and exit
  --dataset DATASET     Dataset used to train (default: cifar10-vgg)
  --data-path DATA_PATH
                        Path of dataset
  --num-hadamard NUM_HADAMARD
                        Number of hadamard codebook columns.
  --code-length CODE_LENGTH
                        Binary hash code length (default: 12)
  --num-query NUM_QUERY
                        Number of query dataset. (default: 1000)
  --num-train NUM_TRAIN
                        Number of training dataset. (default: 20000)
  --topk TOPK           Compute map of top k (default: 5000)
  --lr LR               Learning rate(default: 2e-4)
  --gpu GPU             >0, using gpu id; -1, cpu (default: -1)

Experiments

复现过程中有两个坑。

  1. W,W_prime需要进行归一化,否则W @ data过大,造成tanh只会输出-1,+1,梯度为0,没法更新。
  2. 论文3.4节给出的P的计算公式为P=(1-tanh(x))*tanh(x),作者实际放出的代码里是P=1-tanh(x)*tanh(x),前者没法更新或者效果很差, 我没细推公式,可能是作者论文里打错公式了。

cifar10: 1000 query images, 20000 training images, 60000 database images.

每个code_length跑10次,计算map平均值。

Cifar10 8-bit 16-bit 32-bit 64-bit 128-bit
mAP 0.561 0.656 0.728 0.736 0.745
Precision@500 0.633 0.725 0.778 0.782 0.793

hcoh_pytorch's People

Contributors

treezzz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aspnetcs

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.