Giter VIP home page Giter VIP logo

ivclab / adalabelhash Goto Github PK

View Code? Open in Web Editor NEW
7.0 7.0 0.0 270 KB

Huei-Fang Yang, Cheng-Hao Tu, and Chu-Song Chen, "Adaptive Labeling for Hash Codes Learning via Neural Networks," IEEE International Conference on Image Processing, ICIP 2019, September 2019

License: BSD 3-Clause "New" or "Revised" License

MATLAB 18.84% Shell 5.08% Python 76.09%
deep-neural-networks tensorflow image-retrieval hash-code-generator label-representations hash-codes deep-hash

adalabelhash's Introduction

AdaLabelHash

Official implmemtation of ADAPTIVE LABELING FOR HASH CODE LEARNING VIA NEURAL NETWORKS

Created by Huei-Fang Yang, Cheng-Hao Tu, Chu-Song Chen

Introduction

Learning-based hash has been widely used for large-scale similarity retrieval due to the efficient computation and condensed storage of binary representations. In this paper, we propose AdaLabelHash, a hash function learning approach via neural networks. In AdaLabelHash, class label representations are adaptable during the network training. We express the labels as hypercube vertices in a K-dimensional space, and both the network weights and class label representations are updated in the learning process. As the label representations are explored from data, semantically similar categories will be assigned with the label representations that are close to each other in terms of Hamming distance in the label space. The label representations then serve as the desired output of the hash function learning so as to yield compact and discriminating binary hash codes via the network. AdaLabelHash is simple but effective, which can jointly learn label representations and infer compact binary codes from data. It is applicable to both supervised and semi-supervised learning of hash codes. Experimental results on standard benchmarks show the effectiveness of AdaLabelHash.

Prerequisites

  • python2.7
  • keras2.3.0
  • tensorflow1.13.1
  • scikit-learn0.20.4

Use the following command to install all requirements:

$ pip install -r requirements.txt

If you want to evaluate the image retrieval performance, you need matlab as well.

Usage

We present the instructions on training and testing on CIFAR10 as follows:

Preparing data

  • You will need to download the pretrained CNN_F and place vgg_cnn_f_rmlast.h5 in init_weights/. We convert the pretrained weights from Caffe so that we can load them using Keras. The Caffe version of weights are provided here.

  • For CIFAR10, we convert the numpy formats provided in the official website into the png formats. Download the converted CIFAR10, extract the .zip file and place cifar/ in data/.

Training

Use the following command to train VGG-CNN-F on CIFAR10.

$ bash scripts/run_train.sh '12 24 32 48' 0 

The first argument is a string of integers separated by whitespaces to indicate the hash code lengths for training. In this case, we train 4 VGG-CNN-F models and, they have 12, 24, 32, 48 bits of hash codes, respectively. The second argument is an integer indicates the gpu_id. The training parameters such as learning rates, epochs, early stopping can be set in setting.cfg.

Testing

Use the following command to compute hash codes for CIFAR10.

$ bash scripts/run_test.sh '12 24 32 48' 0 

The arguments here are the same as those in the training script. This script takes the list of images stored in sample_files/cifar10_supB_query.txt and sample_files/cifar10_supB_query.txt, computes binary codes for them, and store the results under experiments/. We represent binary codes as numpy arrays and store them as .npy formats.

Evaluation (matlab required)

Use the following command for computing mAPs on CIFAR10.

$ cd scripts/ 
$ CODE_LEN=12    ## Use differnt code lengths for eavaluation
$ MATLAB_COMMAND='run_eval({'${CODE_LEN}'}); exit'
$ matlab -r "${MATLAB_COMMAND}" -nojvm -nodesktop -nosplash

Note that you need to specify the code lengh used for evaluation as ${CODE_LEN}.

Citation

Please cite following paper if these codes help your research:

@inproceedings{yang2019adaptive,
    title={Adaptive Labeling For Hash Code Learning Via Neural Networks},
    author={Yang, Huei-Fang and Tu, Cheng-Hao and Chen, Chu-Song},
    booktitle={2019 IEEE International Conference on Image Processing (ICIP)},
    pages={2244--2248},
    year={2019},
    organization={IEEE}
}

@inproceedings{yang2019adaptive,
    title={Adaptive Labeling for Deep Learning to Hash},
    author={Yang, Huei-Fang and Tu, Cheng-Hao and Chen, Chu-Song},
    booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition Workshops},
    pages={0--0},
    year={2019}
}

Contact

Please feel free to leave suggestions or comments to Huei-Fang Yang([email protected]), Cheng-Hao Tu([email protected]), Chu-Song Chen([email protected])

adalabelhash's People

Contributors

andytu28 avatar jia-honghenrylee avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

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.