Closed kmactavish closed 5 years ago
Hi, there are different ways to build the precision-recall curve.
One option, that you have discovered, is mask out the diagonal (new place detection), and only consider the below-diagonal place-recognition probabilities. You could even mask out a larger diagonal band (so you don't just always match to the previous image)---just explain that that is what you're doing. You will also need to mask those entries out of the truth
matrix, since those do not contribute to ntruth
---you aren't trying to match to them any more, so they don't contribute to your precision-recall.
By picking a single threshold, 0.99
, you will only get a single precision-recall value, not a curve. The curve is generated by sweeping the threshold from 0 to 1, and recording every precision/recall value along the way.
Thank you for your advice.But I still don't know how to deal with truth matrix.There are continuous 1 in same row but not near the diagonal band.So how to get the right ntruth.The new matlab code:
for k=0:10
psame=psame+diag(-diag(psame,-k),-k);
end
R=[];P=[];
for k=0:10
truth
=truth
+diag(-diag(truth
,-k),-k);
end
ntruth
=length(find(truth==1));
for ploop=0:0.001:1
psame1=(psame>=ploop);
npsame=length(find(psame1==1));
tp=length(intersect(find(psame1==1),find(truth==1)));
r=tp/ntruth;
p=tp/npsame;
R=[R r];P=[P p];
end
plot(R,P)
The ground truth means that the two frames are within some distance of each other (fixed parameter). So there could be multiple correct loop closures for a query (multiple ones in a row). With high confidence, fabmap only gives you one (since the likelihood is normalized and sums to one). So you will have a whole bunch of false negatives, this is normal. You could filter out these false negatives by 'not counting', in ntruth, those that are 'close enough' to the identified loop closure.
With low confidence,fabmap will give multiple ones in a row.So I deal with thentruth
like this:
ntruth
=length(find(sum(truth
,2)>0));%how many lines have 1 in truth
ntruth
=ntruth
+npsame
-length(find(sum(psame1
,2)>0));%
The PR curve is shown follows:
It seems to be right.
the name of the x and y axis in your figure should be swapped
Question from @wengxiuling36: