Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSF Track Estimation C++ #618

Merged
merged 20 commits into from
Sep 5, 2023
Merged

DSF Track Estimation C++ #618

merged 20 commits into from
Sep 5, 2023

Conversation

stepanyanhayk
Copy link
Collaborator

@stepanyanhayk stepanyanhayk commented Apr 2, 2023

This PR integrates gtsam's DSF track estimation into gtsfm. The main purpose of this change is to bring runtime speedup by using C++ instead of Python.

@stepanyanhayk stepanyanhayk changed the title Cpp data assoc Data Association C++ Apr 2, 2023
@stepanyanhayk stepanyanhayk changed the title Data Association C++ DSF Track Estimation C++ Apr 2, 2023
@stepanyanhayk stepanyanhayk marked this pull request as ready for review April 7, 2023 20:01
Copy link
Collaborator

@akshay-krishnan akshay-krishnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few questions:

  • What is the speedup youre getting?
  • Can we use the gtsam data structures in other places in gtsfm, so that we can reduce the spike in memory usage by this module, and the time to copy from one to another? I think this should be possible for at least some of them.

@akshay-krishnan
Copy link
Collaborator

Could you verify the results in the CI? Make sure everything works without any accuracy loss?

@johnwlambert
Copy link
Collaborator

Thanks for adding the unit test, @stepanyanhayk!

I believe CI is failing:

tests/data_association/test_dsf_tracks_estimator.py:113:1: E302 expected 2 blank lines, found 1

Do you mind taking a look, and reformatting?

@johnwlambert
Copy link
Collaborator

Test and code looks great! Re @akshay-krishnan 's questions -- Hayk, could you attach a dashboard to this PR, showing the performance difference vs. master? Re benchmarking, you would see the greatest speedup on loftr, because it generates orders of magnitudes more tracks.

@johnwlambert
Copy link
Collaborator

By the way, the dashboard generation script is here: https://github.com/borglab/gtsfm/blob/master/gtsfm/evaluation/visualize_benchmark_comparison.py. It requires downloading the artifacts from a previous run on master (say the most recently landed PR), and the artifacts from this PR, and putting them in separate directories, and unzipping them. A report will be created, which looks like #594 (comment)

@stepanyanhayk
Copy link
Collaborator Author

Thanks a lot for the pointer, John. I will create the report today

@akshay-krishnan
Copy link
Collaborator

@stepanyanhayk friendy ping on this

@stepanyanhayk
Copy link
Collaborator Author

stepanyanhayk commented Apr 21, 2023

Sorry for the delay, @akshay-krishnan. These are the results I get from comparing the artifacts

image

image

image

image

@akshay-krishnan
Copy link
Collaborator

akshay-krishnan commented Apr 21, 2023

would mainly look at data association metrics.
# tracks computed with GT cameras EXCEEDS_REPOJ_ERROR, computed cameras: EXCEEDS_REPROJ_ERROR is regressing significantly, which means that we have more bad 2D tracks.
Shouldnt this PR be a no-op in terms of quality? @johnwlambert ? Are there any logical changes?

Copy link
Collaborator

@akshay-krishnan akshay-krishnan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpicky comment on comments:
For example: "converting gtsfm Keypoints into gtsam Keypoints"

  1. Punctuation -> "Converting gtsfm Keypoints into gtsam Keypoints."
  2. Simple tense (like an instruction) -> "Convert gtsfm Keypoints into gtsam Keypoints."

Please refer to other comments in the file. I am personally flexible about these, but since its an open source project, I see some PRs fixing unrelated comments from other PRs. Better to write good comments to begin with :)

@johnwlambert
Copy link
Collaborator

Interesting, thanks for the dashboard @stepanyanhayk! Yes, this change should be a no-op. To understand better if we're seeing stochasticity from gtsfm itself, vs. from the change, we could make the dashboard one more time, with a second run from the CI. I'll retrigger a new run also. Would you mind checking the visual quality on any of the datasets?

Which master branch PR were you comparing with? (could you share a link?)

@stepanyanhayk
Copy link
Collaborator Author

Interesting, thanks for the dashboard @stepanyanhayk! Yes, this change should be a no-op. To understand better if we're seeing stochasticity from gtsfm itself, vs. from the change, we could make the dashboard one more time, with a second run from the CI. I'll retrigger a new run also. Would you mind checking the visual quality on any of the datasets?

Which master branch PR were you comparing with? (could you share a link?)

I was comparing with this master PR.

@stepanyanhayk
Copy link
Collaborator Author

Hi @johnwlambert, @akshay-krishnan

I have created a new dashboard with the recent run but it did not change the results, we still see the regression on the Data Association Metrics.

image

In terms of visual quality, I do not see much difference between the master and cpp changes.

Master:
Screenshot 2023-04-30 at 5 08 36 PM
Screenshot 2023-04-30 at 5 08 29 PM

Branch:
Screenshot 2023-04-30 at 5 04 02 PM
Screenshot 2023-04-30 at 5 03 11 PM

To debug further I have created a small notebook comparing the results from DsfTracksEstimator.run() function calls on both master and cpp versions: only 72% of the resulting tracks are the same.

Screenshot 2023-04-30 at 5 35 03 PM

So, the CPP implementation and Python implementation do not output the same 2D tracks. What are your thoughts on this? Do you think the issue might be from the CPP side?

@akshay-krishnan
Copy link
Collaborator

@johnwlambert please update the dashboard once we can use your C++ fixes

@johnwlambert
Copy link
Collaborator

BA Metrics:
Screen Shot 2023-09-04 at 9 59 14 PM

Screen Shot 2023-09-04 at 9 59 49 PM

@johnwlambert johnwlambert merged commit 2007ba5 into master Sep 5, 2023
24 checks passed
@johnwlambert johnwlambert deleted the cpp-data-assoc branch September 5, 2023 02:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants