yewzijian / 3DFeatNet

3DFeat-Net: Weakly Supervised Local 3D Features for Point Cloud Registration
MIT License
220 stars 46 forks source link

how to correctly evaluate registration #13

Closed Jarrome closed 4 years ago

Jarrome commented 4 years ago

Hi, Zi Jian,

I'm currently comparing the registration performance with 3DFeatnet. I find directly using ransacRt merely run 35 iteration and give a bad result on both sides.

So I'm little curious how to use your script correctly on registration. Maybe the 99% confidence or something?

yewzijian commented 4 years ago

Hi Jarrome,

By default, the code is already set to 99% confidence (see ransac.m). It's weird that the ransac terminates after only 35 iterations. This will require a very high "inlier" ratio. Is this on your own dataset or does it also happen on my example test data?

Zi Jian

Jarrome commented 4 years ago

Hi, Zi Jian,

I'm using your test_models, the keypoint is with ISS. Both your 3Dfeatnet and my model doesn't work on this registration. The keypoint+desc test works fine.

The inlier proportion is around 0.5

yewzijian commented 4 years ago

That shouldn't be a problem, we tested that configuration before.

Maybe you can check if the ISS keypoints are detected/read correctly? I'm also attaching the ISS keypoints for the example data (oxford_270, oxford_456), which can be loaded to inference.py using the --use_keypoints_from argument. Verify if these keypoint files works ok?

Jarrome commented 4 years ago

Hi, Zi Jian,

Yeah, it works fine.

Running on frames:
- ../example_data/oxford_270.bin
- ../example_data/oxford_456.bin
Number of inliers: 66 / 600 (Proportion: 0.110. #RANSAC trials: 3458)

Here's the script for registration on test_models

addpath('./external');

clear;
m = 6;  % Dimensionality of raw data

DATA_FOLDER = '../data/oxford/test_models';
RESULT_FOLDER = '../test_results';

ALGO = '3dfeatnet'; featureDim = 32;

%% Load pairs
algoResultFolder = fullfile(RESULT_FOLDER, ALGO);
test_pairs = readtable(fullfile(DATA_FOLDER, 'groundtruths.txt'));

tic
for iPair = 1 : height(test_pairs)

    frames = [test_pairs.idx1(iPair), test_pairs.idx2(iPair)];
    fprintf('Running pair %i of %i, containing frames %i and %i\n', ...
        iPair, height(test_pairs), frames(1), frames(2));

    % Load point cloud and descriptors
    for i = 1 : 2
        r = frames(i);

        %pointcloud{i} = Utils.loadPointCloud(fullfile(DATA_FOLDER, sprintf('%d.bin', r)), m);

        binfile = fullfile(algoResultFolder, sprintf('%d.bin', r));
        xyz_features = Utils.load_descriptors(binfile, sum(featureDim+3));

        result{i}.xyz = xyz_features(:, 1:3);
        result{i}.desc = xyz_features(:, 4:end);
    end

    % Match
    [~, matches12] = pdist2(result{2}.desc, result{1}.desc, 'euclidean', 'smallest', 1);
    matches12 = [1:length(matches12); matches12]';  

    %  RANSAC
    cloud1_pts = result{1}.xyz(matches12(:,1), :);
    cloud2_pts = result{2}.xyz(matches12(:,2), :);
    [estimateRt, inlierIdx, trialCount] = ransacfitRt([cloud1_pts'; cloud2_pts'], 1.0, false);
    fprintf('Number of inliers: %i / %i (Proportion: %.3f. #RANSAC trials: %i)\n', ...
            length(inlierIdx), size(matches12, 1), ...
            length(inlierIdx)/size(matches12, 1), trialCount);
yewzijian commented 4 years ago

Yup the results are as expected. The code also looks alright, though I didn't take a detailed look. Did you find out what's causing the issue?

Jarrome commented 4 years ago

Ah... I have no clue... But the example data takes 0.11 proportion while test_models have around 0.5. Will that be the problem?

Jarrome commented 4 years ago

Hi, Zi Jian,

It is my bug.

The keypoint.bin is with 3 float each point not 6. I thought it is same as pointcloud.bin and pad some extra zeros.

Thank you, I appreciate your help. :)