Coder Social home page Coder Social logo

filipradenovic / cnnimageretrieval Goto Github PK

View Code? Open in Web Editor NEW
190.0 14.0 54.0 76 KB

CNN Image Retrieval in MatConvNet: Training and evaluating CNNs for Image Retrieval in MatConvNet

Home Page: http://cmp.felk.cvut.cz/cnnimageretrieval

License: MIT License

MATLAB 100.00%
image-retrieval convolutional-neural-networks cnn matlab matconvnet

cnnimageretrieval's People

Contributors

carandraug avatar filipradenovic 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

cnnimageretrieval's Issues

strongly recommend to use Pytorch or Tensorflow as computing platform in the future :)

Hi filip, your code is written very elegant and with amazing performance. But I recommend you to use Pytorch or tensorflow for your future work. Since matconvnet is not friendly to quickly use and development community is not strong. Moreover the training efficiency and deployment would be inferior to the above platforms. Python is more convenient to process network and data.

Thanks for your code sharing again !

Adam solver issue

It gives me an error for the following line:
assert(isa(opts.train.solver, 'function_handle') && nargout(opts.train.solver) == 2,...
'Invalid solver; expected a function handle with two outputs.');

Error using nargout
Function solver.adam does not exist.

It seems there is no @solver.adam in Matlab R2017a.

Why the fine-tuned CNN just has one branch

The finetuned CNN is a Siamese network which usually has two branches. However, I found each of the fine-tuned models you provided has one branch. Is this because the training samples are tuples consisting of query image, positive image and several negative images instead of images? And also, when you compute the contrastive loss, it is computed on the tuple which actually consists of 6 image pairs? The batchsize is set to 5, does that mean one batch consists of 5 tuples and then 30 image pairs in total?
Look forward to your reply, thanks in advance!

error in Corrupt JPEG data

Hi,Thanks for sharing code. I got the following error. Any suggestions?

Running on GPU Tesla V100-SXM2-32GB with Index 3
[ 22.11%] [== ] [t 5.0m] [e 1.1m] [r 3.9m] Corrupt JPEG data: 67 extraneous bytes before marker [0xd7]
[ 33.75%] [=== ] [t 5.0m] [e 1.7m] [r 3.3m] Corrupt JPEG data: 10 extraneous bytes before marker 0xd9
[ 47.71%] [==== ] [t 5.1m] [e 2.4m] [r 2.7m] Corrupt JPEG data: 1 extraneous bytes before marker 0xd9
[100.00%] [==========] [t 5.0m] [e 5.0m] [r 0.0s] done.
Context::clear()
Context::~Context()
Remining negatives
Compute cnndesc for the hard negative mining...
[100.00%] [==========] [t 5.0m] [e 5.0m] [r 0.0s] done.
Remine hard negatives...
[100.00%] [==========] [t 6.5s] [e 6.5s] [r 0.0s] done.

why “corrupt the JPEG data”

error in get_images()

Hi,
Thanks for sharing code. I got the following error. Any suggestions?

Validation images not provided, loading...

imageDir: /playpen/cnnimageretrieval/data/train/ims
Running on GPU GeForce GTX TITAN X with Index 1

[ 0.00%] [ ] [t ?] [e 0.0s] [r ?] Error using imresizegpumex
Expected input scale to be a real, positive scalar of numeric type on the CPU.

Error in gpuArray/imresize (line 46)
B = imresizegpumex(varargin{:});

Error in imresizemaxd (line 19)
im = imresize(im, [sz NaN], method);

Error in get_images>@(x)imresizemaxd(x,opts.imageSize)

Error in get_images>getImageBatch (line 78)
data = cellfun(@(x) imresizemaxd(x, opts.imageSize), data, 'UniformOutput', false);

CUDA support for matconvnet?

Is matconvnet compiled with or without cuda support? If it is with cuda support could you give more details on what driver version and toolkit version was used. Thanks!

Is it possible to run the training code on a less powerful GPU?

I went through the second paper and it says the training was done on a TITAN X with 12GB of memory. I tried running the training code on a system with GTX 1070 with 8GB of memory and get the following error even if I reset the GPU memory at the start:

Error using gpuArray/max
Out of memory on device. To view more detail about available memory on the GPU, use 'gpuDevice()'. If
the problem persists, reset the GPU by calling 'gpuDevice(1)'.

Error in vl_nnrelu (line 45)
    y = max(x, 0) ;

Error in dagnn.ReLU/forwardAdvanced (line 29)
      net.vars(out).value = vl_nnrelu(net.vars(in).value, [], ...

Error in dagnn.DagNN/eval (line 91)
  obj.layers(l).block.forwardAdvanced(obj.layers(l)) ;

Error in train_network>processEpoch (line 228)
      net.eval(inputs, params.derOutputs, 'holdOn', subbatch < params.numSubBatches) ;

Error in train_network (line 90)
    [net, state] = processEpoch(net, state, params, 'train') ;

Error in train_cnnimageretrieval (line 66)
[net, state, stats] = train_network(net, @(o,i,n,b,s,m,e) get_batch(o,i,n,b,s,m,e), opts.train);

Is there a way to solve this by using a smaller subset of the training data or some other way?
Thanks!

Incorrect input image shape in network forward pass

Hi,
I am using your code and my environment is:

  • ubuntu 16.04
  • matlab R2017b
  • matconvnet 1.0-beta25 compiled with option 'enableGpu' and 'cudaRoot' is CUDA-8.0.

I got following error message when executing script test_cnnimageretrieval.m (with use_gpu=1)

>> run test_cnnimageretrieval.m
>> retrievalSfM30k-siamac-vgg: Evaluating CNN image retrieval...
>> whitening: Extracting CNN descriptors for training images...
>>>> [  0.00%] [          ] [t ?] [e 0.0s] [r ?] Error using vl_nnnormalizelp
DATA and DEROUTPUT do not have the same size.

Error in L2N/forward (line 8)
      outputs{1} = vl_nnnormalizelp(inputs{1}, [], 'p', 2, 'epsilon', 1e-6) ;

Error in dagnn.Layer/forwardAdvanced (line 85)
      outputs = obj.forward(inputs, {net.params(par).value}) ;

Error in dagnn.DagNN/eval (line 91)
  obj.layers(l).block.forwardAdvanced(obj.layers(l)) ;

Error in cnn_vec (line 38)
        net.eval({'input', gpuarrayfun(reshape(im, [size(im), 1]))});

Error in test_cnnimageretrieval>@(x,y)cnn_vec(x,y)

Error in test_cnnimageretrieval (line 75)
        vecs_whiten{i} = descfun(imresizemaxd(imread(cid2filename(cids{i}, ims_whiten_dir)), test_imdim, 0), net);

Then I notice in cnn_vec.m line 38
net.eval({'input', gpuarrayfun(reshape(im, [size(im), 1]))});. It seems you want to expand the last dimension of im. However, reshape(im, [size(im), 1]) won't change the shape of it. Or I misunderstood your code?

So I tried to change [size(im), 1] to [1, size(im)] as vl_nnnormalizelp(inputs{1}, [], 'p', 2, 'epsilon', 1e-6) ; takes the first batch. But soon I get another error:

>>>> [  0.00%] [          ] [t ?] [e 0.0s] [r ?] Error using vl_nnconv
The FILTERS depth does not divide the DATA depth.

Error in dagnn.Conv/forward (line 11)
      outputs{1} = vl_nnconv(...

Error in dagnn.Layer/forwardAdvanced (line 85)
      outputs = obj.forward(inputs, {net.params(par).value}) ;

Error in dagnn.DagNN/eval (line 91)
  obj.layers(l).block.forwardAdvanced(obj.layers(l)) ;

Error in cnn_vec (line 38)
        net.eval({'input', gpuarrayfun(reshape(im, [1, size(im)]))});

Error in test_cnnimageretrieval>@(x,y)cnn_vec(x,y)

Error in test_cnnimageretrieval (line 75)
        vecs_whiten{i} = descfun(imresizemaxd(imread(cid2filename(cids{i}, ims_whiten_dir)), test_imdim, 0), net);

Do you have any idea how to solve this? I would be grateful !! THANKS!!!!!!

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.