Git Product home page Git Product logo

Comments (10)

Relja avatar Relja commented on July 29, 2024

Can you give more details on what are you doing, how are you constructing the dataset?

Did you read comments in https://github.com/Relja/netvlad/blob/master/datasets/dbBase.m ? Briefly looking at your error, sounds like there are no positives, so are you sure that you have images that are within the predefined distance threshold (posDistThr) ?

To test if your dataset is working, I would not run training, but just first see if you can succesfully run testCoreRank with some dummy data like dbFeat=zeros(10, length(db.numImages)) and qFeat=zeros(10, length(db.qImages))

from netvlad.

largerC avatar largerC commented on July 29, 2024

what does UTM mean? and how to modify it if i want to use my data?

from netvlad.

Relja avatar Relja commented on July 29, 2024

https://en.m.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system

Create a mat file with the fields as described in
https://github.com/Relja/netvlad/blob/master/datasets/dbBase.m
You can load my mat files and see what they look like.

from netvlad.

largerC avatar largerC commented on July 29, 2024

I Create a mat file with the fields from the dbBase, and load the tokyoTM_train.mat and creative a mat that for our own database, and we change the localpath.
whichSet: 'train'
dbImageFns: {340×1 cell}
utmDb: [2×340 double]
dbTimeStamp: [1×340 double]
qImageFns: {340×1 cell}
utmQ: [2×340 double]
qTimeStamp: [1×340 double]
numImages: 340
numQueries: 340
posDistThr: 25
posDistSqThr: 625
nonTrivPosDistSqThr: 100
And the data above all is our own train.mat ,but I couldn't run it .

from netvlad.

Relja avatar Relja commented on July 29, 2024

So did you check my comment "Briefly looking at your error, sounds like there are no positives, so are you sure that you have images that are within the predefined distance threshold (posDistThr) ?"

Specifically, this line:
https://github.com/Relja/netvlad/blob/master/testCoreRank.m#L33
probably gives empty output?

Positives are defined as here:
https://github.com/Relja/netvlad/blob/master/datasets/dbBase.m#L121
i.e. database images that have a squared UTM distance from the query smaller than nonTrivPosDistSqThr but larger than 1 to eliminate trivial positives (i.e. if your query=database set, then retrieving the same image is trivially easy and would give you 100%, so I make the distance at least 1 to account for this)

from netvlad.

largerC avatar largerC commented on July 29, 2024

I couldn't run the dbFeat=zeros(10, length(db.numImages)) and qFeat=zeros(10, length(db.qImages))
in the testCoreRank. Because the code couldn't run the words after (the line 32-34 in testCoreRank.m)

    qID= toTest(iTestSample);
    potPosIDs= db.nontrivialPosQ(qID);
    if isempty(potPosIDs), continue; end  

the potPosIDs is always empty. Then we open the nontrivialPosQ , and it jump to the (the line 116-119 in dbBase.m)

    function posIDs= nontrivialPosQ(db, iQuery)
        [posIDs, dSq]= db.cp.getPosIDs(db.utmQ(:,iQuery));
        posIDs= posIDs(dSq>1 & dSq<=db.nonTrivPosDistSqThr );
    end

it also says the posIDs is empty.Then we open the getPosIDs , and it jump to the (the line 39-51 in closePosition.m)

  function [posIDs, ds]= getPosIDs(cp, utm)
        inds= cp.getInds( utm );
        posIDs= cat(1, ...
            cp.hashTab{ ...
                max(inds(1)-1, 1) : min(inds(1)+1, cp.hashSz(1)), ...
                max(inds(2)-1, 1) : min(inds(2)+1, cp.hashSz(2)) } ...
            );
        
        ds= sum( bsxfun(@minus, utm, cp.utm(:,posIDs)) .^ 2, 1 );
        keep= ds <= cp.posDistSqThr;
        posIDs= posIDs(keep);
        ds= ds(keep);
    end

and the hashTab is empty.
cp.hashTab{ ...
max(inds(1)-1, 1) : min(inds(1)+1, cp.hashSz(1)), ...
max(inds(2)-1, 1) : min(inds(2)+1, cp.hashSz(2)) } ...
);

So I don't konw how to calculate some variable just like the posDistThr . Could you please give me some advice or example?
P.S: I can't see the example after the "Specifically, this line:" in the last asking.
P.S: what the use for the testcorerank.m?

from netvlad.

Relja avatar Relja commented on July 29, 2024

Maybe you didn't see my edited comment (I accidentally submitted it after "Specifically, this line:", but then edited)

testCoreRank randomly samples triplets (query, all potential positives, negative) and checks if they are correctly ordered (best positive is closer to query than the negative is), which is what the triplet loss is trying to optimize. But skipping it wouldn't solve your problem as your main problem is that there are no potential positives for your training query.

The hashTab is empty because there are no positives (unless there is a bug but I would bet against it). So just check if for any training query you have potential positives, e.g. pick db.utmQ(:, 1) and measure the squared distance from it to all db.utmDb. Are there any database images that are closer than nonTrivPosDistSqThr? I would guess not (otherwise I have a bug). In fact probably all are further away than even posDistSqThr, which is larger.

So you need to fix your dataset or UTM coordinates or increase the nonTrivPosDistSqThr (but this is dangerous as if it is too large, then maybe what you include are not positives).

from netvlad.

largerC avatar largerC commented on July 29, 2024

what is the use of "[obj.pretrain.val.recall, obj.pretrain.val.rankloss]" in trainweakly.m line 190-194 ?
Does the database needs to be pretrain before the real training ?
If I abandon the trainweakly.m line 190-194 what will happen ?

from netvlad.

Relja avatar Relja commented on July 29, 2024

It evaluates the initial network you supply to the code - for me this was generally a pretrained network on ImageNet so that's why I called it 'pretrain', but it can also be a randomly initialized network or whatever you want.

The problem is that your dataset is not set up correctly. This shows up in the evaluation in lines 190-194. If you comment those lines, your code will fail later during training as you have no positives for any of your queries.

from netvlad.

Relja avatar Relja commented on July 29, 2024

Closing this due to inactivity

from netvlad.

Related Issues (20)

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.