Code Monkey home page Code Monkey logo

cvpr16-deepbit's Introduction

CVPR16-DeepBit

Learning Compact Binary Descriptors with Unsupervised Deep Neural Networks

Created by Kevin Lin, Jiwen Lu, Chu-Song Chen, Jie Zhou

Introduction

We propose a new unsupervised deep learning approach to learn compact binary descriptor. We enforce three criterions on binary codes which are learned at the top layer of our network: 1) minimal loss quantization, 2) evenly distributed codes and 3) rotation invariant bits. Then, we learn the parameters of the networks with a back-propagation technique. Experimental results on three different visual analysis tasks including image matching, image retrieval, and object recognition demonstrate the effectiveness of the proposed approach.

The details can be found in the following CVPR 2016 paper

Citation

If you find DeepBit useful in your research, please consider citing:

Learning Compact Binary Descriptors with Unsupervised Deep Neural Networks
Kevin Lin, Jiwen Lu, Chu-Song Chen and Jie Zhou
IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2016

Prerequisites

  1. MATLAB (tested with 2015a on 64-bit Ubuntu)
  2. Caffe's prerequisites

Installation

Adjust Makefile.config and simply run the following commands:

$ make all -j8
$ make matcaffe

For a faster build, compile in parallel by doing make all -j8 where 8 is the number of parallel threads for compilation (a good choice for the number of threads is the number of cores in your machine).

Retrieval evaluation on CIFAR10

First, run the following command to download and set up CIFAR10 Dataset, VGG16 pre-trained on ILSVRC12, DeepBit 32-bit model trained on CIFAR10. This script will rotate training data and create leveldb files.

$ ./prepare.sh

Launch matalb and run run_cifar10.m to perform the evaluation of precision at k and mean average precision at k. We set k=1000 in the experiments. The bit length of binary codes is 32.

>> run_cifar10

Then, you will get the mAP result as follows.

>> MAP = 0.25446596

Note: CIFAR10 dataset is split into training and test sets, with 50,000 and 10,000 images, respectively. During retrieval process, the 50,000 training images are treated as the database. We use the 10,000 test images as the query samples.

Train DeepBit on CIFAR10

Simply run the following command to train DeepBit:

$ cd /examples/deepbit-cifar10-32
$ ./train.sh

The training process takes a few hours on a desktop with Titian X GPU. You will finally get your model named DeepBit32_final_iter_1.caffemodel under folder /examples/deepbit-cifar10-32/

To use the model, modify the model_file in run_cifar10.m to link your model:

    model_file = './YOUR/MODEL/PATH/filename.caffemodel';

Launch matlab, run run_cifar10.m and test the model!

>> run_cifar10

Resources

Note: This documentation may contain links to third party websites, which are provided for your convenience only. Third party websites may be subject to the third party’s terms, conditions, and privacy statements.

If the automatic "fetch_data" fails, you may manually download the resouces from:

  1. For ./prepare.sh:

DeepBit models in the paper:

  1. The proposed models trained on CIFAR10:

Experiments on Descriptor Matching and Object Recognition

comming soon...

Contact

Please feel free to leave suggestions or comments to Kevin Lin ([email protected]), Jiwen Lu ([email protected]) or Chu-Song Chen ([email protected])

cvpr16-deepbit's People

Contributors

kevinlin311tw avatar suvojit-0x55aa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cvpr16-deepbit's Issues

Time ORB and DeepBit

Section 4.2. "Results in Image Matching" What was the processing time of the descriptor ORB and DeepBit?
Because I would use the DeepBit in time real for image matching.

mAP

I had followed your instruction step by step, why that I can't get the ideal results presented in your paper. Is there anything that I should pay extra attention to?

About the K1&K2_EuclideanLossLayer

I'm a beginner of deep hash, and I admire this method. I have already achieve generating hash codes by adding latent layer on my own dataset. 
Then I wanna improve it, but I can't find **the registrations of K1&K2_EuclideanLossLayer and their LayerParameters** in **caffe.proto**, are they necessary?

why add (i*channels) in dot product operation? why have two weight?

Hello, can help me explain this loss code, I do not understand, thank you very much!For example, why add (i*channels) in dot product operation? why have two weight?

for (int i = 0; i < bottom[0]->num(); ++i) {
dist_sq_.mutable_cpu_data()[i] = caffe_cpu_dot(channels,
diff_.cpu_data() + (ichannels), diff_.cpu_data() + (ichannels));

loss += (rotation_weight2[i]*(rotation_weight1[i]*dist_sq_.cpu_data()[i]));

}

Change max_iter for training new model

Hi, thank you for your working.

I just wonder how I can change max_iter parameter (in Optimization step) as your paper presented. In your example with Cifar I could not find where to change max_iter.

Thank you in advance.

The deploy model file cannot be adapt to the caffe of current BVLC version

run_cifar10
cvpr16-deepbit startup
Cleared 0 solvers and 0 stand-alone nets
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0617 21:46:16.693743 67684 upgrade_proto.cpp:52] Attempting to upgrade input file specified using deprecated V1LayerParameter: ./models/deepbit/deploy32.prototxt
F0617 21:46:16.715786 67684 upgrade_proto.cpp:660] Refusing to upgrade inconsistent NetParameter input; the definition includes both 'layer' and 'layers' fields. The current format defines 'layer' fields with string type like layer { type: 'Layer' ... } and not layers { type: LAYER ... }. Manually switch the definition to 'layer' format to continue.

check fail on imagenet_mean_binaryproto

Hi, I tried to use train.sh to get the training model. However, when caffe tried to load mean file from imagenet_mean.binaryproto, it gives me an error "check failed: !lines_.empty() File is empty". How can I handle this error? Thanks very much.

How to binarize the features from fc8_kevin layer

I am trying to deploy the network with python. Can someone help me with converting converting the features from fc8_kevin to binary. For example, the output from fc8 is like this.

[[-0.56248081 -0.45775688 -1.30485046 -0.1604958 1.5815804 0.77081078
-0.7585181 -1.10825634 -1.4173944 -0.79846704 0.49331596 -0.42672595
0.13242441 -0.19356699 -1.40226376 -0.30305305 0.51420587 -0.613258
-0.56232476 -1.44308019 -1.60355341 -0.82647151 0.34802282 -1.08634388
-0.70180577 -1.15342426 -1.00441277 0.03183408 0.90380871 -0.03189395
-0.22369295 0.1908104 ]]

All binary vectors are the same

Hi,

I retrain the model on the NUSWIDE dataset. But the output binary codes for all the test and database samples are the same. Namely, the pdist2 matrix is zero matrix.

I wanna to know why this happen?

Unsupervised Binary Descriptor

Hi guys,
Although I read the paper and have a look at the source code, I could not understand how it works with the unsupervised approach.

This code snippet is from K2_min_quantization_loss_layer.
How is bottom_data calculated?

  for ( int i = 0; i < count; i++)
  {
	if(bottom_data[i] > 0.5){
		binary[i] = 1;
	}
	else{
		binary[i] = 0; 
	}
  }
  for (int i = 0; i < count; ++i) {
	loss = loss + (binary[i]-bottom_data[i])*(binary[i]-bottom_data[i]);
        diff_.mutable_cpu_data()[0] = diff_.mutable_cpu_data()[0] + (binary[i]-bottom_data[i])*(-bottom_data[i]);
  } 

Check failed: fd != -1 (-1 vs. -1) File not found: solver_stage1.prototxt

I got the following error while executing train.sh script.How can I handle this error? Thanks very much.

Check failed: fd != -1 (-1 vs. -1) File not found: solver_stage1.prototxt
*** Check failure stack trace: ***
@ 0x7ffbddd355cd google::LogMessage::Fail()
@ 0x7ffbddd37433 google::LogMessage::SendToLog()
@ 0x7ffbddd3515b google::LogMessage::Flush()
@ 0x7ffbddd37e1e google::LogMessageFatal::~LogMessageFatal()
@ 0x7ffbde3fa178 caffe::ReadProtoFromTextFile()
@ 0x7ffbde400ff6 caffe::ReadSolverParamsFromTextFileOrDie()
@ 0x40ad3a train()
@ 0x407fc0 main
@ 0x7ffbdcc2f830 __libc_start_main
@ 0x4087e9 _start
@ (nil) (unknown)

Installation Error

After installing the requirements, when I run the code make all -j8, I got this error.

LD -o .build_release/lib/libcaffe.so
ld: framework not found vecLib
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [.build_release/lib/libcaffe.so] Error 1

So I think it can not find vecLib.
I use macOs Mojave 10.14.5.

So what should I do?
Thanks in advance

Really outperform baselines that much ?

Hi, I have noticed that reported performance has far beyond baselines but which is mAP@1K. Consider your baselines are all mAP which should be lower than mAP@1K in your implementation. As claimed in section 4.3,

Following the settings in [24](Deep hashing for compact binary codes learning, CVPR 15) ...

however, DH reported mAP rather than mAP@1K (if you double check the setting in [24]). Could you please give us more details about the real mAP on Cifar10 to fully compare with others.
In our evaluation, even ITQ (well-known and still competitive baseline) has reached 20+ mAP@1K, which makes us wonder whether Deepbit outperforms baselines that much?

Anyway, good work and thanks for the open source codes.

perform prepare.sh failed

Execute "./prepare.sh" failed:

I can access dropbox.com but cannot access the model and dataset mentioned in prepare.sh.

Any alternative solution?

train.sh

Hi, When I run the ./train.sh common, the following error ,how to solve the problem , thanks
error: check failed : fd != -1 (-1 vs. -1) File not found : DeepBit32_stage2_iter_5000.caffemodel

loss1 remains large and loss2 decrease to 0

When I fine tune VGG16 with the code provided in stage1, loss1 increases until 0.25 and loss2 decreases to a small value < 1e-5. I use output bits: 64, batch size:32. Can someone give me any advice about this strange situation?

Error during runtest

We get the following error when we do "make runtest". We use CUDA 7.5 on Ubuntu 14.04. Could you please suggest a solution for it?

https://github.com/kevinlin311tw/cvpr16-deepbit/blob/master/README.md

[----------] 4 tests from ImageDataLayerTest/0, where TypeParam = caffe::CPUDevice

[ RUN ] ImageDataLayerTest/0.TestShuffle

*** Aborted at 1470802253 (unix time) try "date -d @1470802253" if you are using GNU date ***

PC: @ 0x2b17d11def20 (unknown)

*** SIGSEGV (@0x0) received by PID 43804 (TID 0x2b17cbfc91c0) from PID 0; stack trace: ***

@     0x2b17d2301d40 (unknown)

@     0x2b17d11def20 (unknown)

@           0x569cac std::operator+<>()

@     0x2b17d1645117 caffe::ImageDataLayer<>::DataLayerSetUp()

@     0x2b17d1626ce3 caffe::BasePrefetchingDataLayer<>::LayerSetUp()

@           0x5519ea caffe::ImageDataLayerTest_TestShuffle_Test<>::TestBody()

@           0x7b4803 testing::internal::HandleExceptionsInMethodIfSupported<>()

@           0x7ab4e7 testing::Test::Run()

@           0x7ab58e testing::TestInfo::Run()

@           0x7ab695 testing::TestCase::Run()

@           0x7ae9d8 testing::internal::UnitTestImpl::RunAllTests()

@           0x7aec67 testing::UnitTest::Run()

@           0x44fd4a main

@     0x2b17d22ecec5 (unknown)

@           0x456169 (unknown)

@                0x0 (unknown)

make: *** [runtest] Segmentation fault (core dumped)

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.