test_mega1500.py 1.0 KB

12345678910111213141516171819202122
  1. from romatch.benchmarks import MegaDepthPoseEstimationBenchmark
  2. import numpy as np
  3. def test_mega1500(model, name):
  4. mega1500_benchmark = MegaDepthPoseEstimationBenchmark("data/megadepth")
  5. mega1500_results = mega1500_benchmark.benchmark(model, model_name=name)
  6. return mega1500_results
  7. if __name__ == "__main__":
  8. from romatch import roma_outdoor
  9. device = "cuda"
  10. model = roma_outdoor(device = device, coarse_res = 672, upsample_res = 1344, use_custom_corr=True)
  11. experiment_name = "roma_latest"
  12. results = test_mega1500(model, experiment_name)
  13. print(results)
  14. # gotten on 3.12 env with torch 2.8.0
  15. reference_scores = [0.6271474434923545, 0.7673889435429945, 0.8642099162282599] # slightly worse.
  16. # old_reference_scores = [0.6235757679569996, 0.7648007367330985, 0.8630483724961098]
  17. assert np.isclose(results["auc_5"], reference_scores[0], atol=3e-1 / 100)
  18. assert np.isclose(results["auc_10"], reference_scores[1], atol=2e-1 / 100)
  19. assert np.isclose(results["auc_20"], reference_scores[2], atol=1e-1 / 100)