[VPI][Brute-Force Matcher] Intriguing non-reproducible results

Hello everyone,

I’m currently implementing an application featuring a VPI ORB detector and VPI brute-force matching with cross-check.

I encountered a situation where I process the “same” query and reference descriptors twice, but I don’t get identical results. Since the C++ codebase is quite complex, I’ll explain the issue with pseudo code first. If necessary, I’ll try to reproduce the problem in a simple standalone example.

Here’s the scenario: I retrieve two consecutive frames, compute their ORB features, and perform brute-force matching. I then filter all the query descriptors that didn’t match ([-1, -1]). When I run a new brute-force matching with the filtered queries, I retrieve the same matches as I did with the original query.

My issue arises when I shuffle this query (to simulate how the reference vector is GPU-built in my application). After shuffling, the output differs slightly, with 2 or 3 out of 1000 matches producing different results (new [-1, -1] mismatch).

The pseudo code would be the following :


img1 = videomanager.getFrame();
// vpiSubmitORBFeatureDetector(...)
imgDescs1 = getDescriptors();
img2 = videomanager.getFrame();
imgDescs2 = getDescriptors();

// vpiSubmitBruteForceMatcher(...)
matches1 = VPI_bfm(imgDescs2, imgDescs1);

// Remove from imgDesc2 all queries that didn’t match
imgDesc2_pruned = eraseQueryMismatches(imgDesc2, matches1);

matches2 = VPI_bfm(imgDesc2_pruned, imgDescs1);

// Insert both matches into std::sets and compare them
compareMatches(matches1, matches2);
// matches1 and matches2 are identicals


// Shuffle the previous query descriptors
imgDesc2_shuffled = std::shuffle(imgDesc2_pruned);

matches3 = VPI_bfm(imgDesc2_shuffled, imgDescs1);

// matches1 and matches3 are slightly differents
compareMatches(matches1, matches3)

I’d like to know if it’s expected behavior that the order of descriptors within the query affects the results. I’m struggling to understand why this might happen. My whole application is using VPI with CUDA backend.

Thanks for your help.