Skip to content

Scale cauchy loss to approximate r^2 in inlier region#143

Merged
vlarsson merged 2 commits into
PoseLib:masterfrom
theartful:cauchy_scale
Jul 4, 2025
Merged

Scale cauchy loss to approximate r^2 in inlier region#143
vlarsson merged 2 commits into
PoseLib:masterfrom
theartful:cauchy_scale

Conversation

@theartful

@theartful theartful commented Jun 11, 2025

Copy link
Copy Markdown
Contributor

This PR scales cauchy loss by threshold^2 so that it approximates the squared error in the inlier region.

I also added some missing std includes (algorithm for std::min, cmath for std::log1p, limits for std::numeric_limits).

Fixes #142

@vlarsson

Copy link
Copy Markdown
Collaborator

Thanks for implementing this. If possible, could you run through the posebench suite https://github.com/vlarsson/posebench with and without the fix to confirm there is no regression? Otherwise I can run it too once I find the time.

Thanks again!

@theartful

Copy link
Copy Markdown
Contributor Author

Sure, here are the results before:

Datasets: eth3d_130_dusmanu,7scenes_heads,7scenes_stairs,cambridge_landmarks_GreatCourt,cambridge_landmarks_ShopFacade,cambridge_landmarks_KingsCollege,cambridge_landmarks_StMarysChurch,cambridge_landmarks_OldHospital,megadepth1500_sift,megadepth1500_spsg,megadepth1500_splg,megadepth1500_roma,megadepth1500_dkm,megadepth1500_aspanformer,scannet1500_sift,scannet1500_spsg,scannet1500_roma,scannet1500_dkm,scannet1500_aspanformer,imc_british_museum,imc_london_bridge,imc_piazza_san_marco,imc_florence_cathedral_side,imc_milan_cathedral,imc_sagrada_familia,imc_lincoln_memorial_statue,imc_mount_rushmore,imc_st_pauls_cathedral,barath_Alamo,barath_NYC_Library

                AUC0   AUC1   AUC5   med_rot   med_pos   avg_rt   med_rt 
PnP (poselib)  50.51  89.72  96.95   3.3E-01       0.1   12.7ms   11.5ms 
PnP (COLMAP)   50.65  89.70  96.87   3.4E-01       0.1   24.8ms   23.4ms 

              AUC5   AUC10   AUC20   avg_rt   med_rt 
E (poselib)  49.14   63.49   74.70   35.0ms   31.6ms 
E (COLMAP)   42.39   58.69   71.87   46.7ms   39.8ms 
F (poselib)  34.04   47.86   60.51   31.5ms   27.1ms 
F (COLMAP)   29.36   43.16   56.55   20.7ms   15.1ms 

              AUC5   AUC10   AUC20   avg_rt   med_rt 
H (poselib)   0.86    2.54    7.15  583.8us  398.2us 
H (COLMAP)    0.73    2.39    6.82    2.2ms    2.1ms 

after:

Datasets: eth3d_130_dusmanu,7scenes_heads,7scenes_stairs,cambridge_landmarks_GreatCourt,cambridge_landmarks_ShopFacade,cambridge_landmarks_KingsCollege,cambridge_landmarks_StMarysChurch,cambridge_landmarks_OldHospital,megadepth1500_sift,megadepth1500_spsg,megadepth1500_splg,megadepth1500_roma,megadepth1500_dkm,megadepth1500_aspanformer,scannet1500_sift,scannet1500_spsg,scannet1500_roma,scannet1500_dkm,scannet1500_aspanformer,imc_british_museum,imc_london_bridge,imc_piazza_san_marco,imc_florence_cathedral_side,imc_milan_cathedral,imc_sagrada_familia,imc_lincoln_memorial_statue,imc_mount_rushmore,imc_st_pauls_cathedral,barath_Alamo,barath_NYC_Library

                AUC0   AUC1   AUC5   med_rot   med_pos   avg_rt   med_rt 
PnP (poselib)  50.51  89.72  96.95   3.3E-01       0.1   13.9ms   12.6ms 
PnP (COLMAP)   50.65  89.70  96.87   3.4E-01       0.1   27.3ms   25.8ms 

              AUC5   AUC10   AUC20   avg_rt   med_rt 
E (poselib)  49.14   63.49   74.70   35.4ms   32.0ms 
E (COLMAP)   42.39   58.69   71.87   47.1ms   40.2ms 
F (poselib)  34.05   47.86   60.50   31.3ms   27.0ms 
F (COLMAP)   29.36   43.16   56.55   20.9ms   15.2ms 

              AUC5   AUC10   AUC20   avg_rt   med_rt 
H (poselib)   0.86    2.54    7.15  562.7us  383.5us 
H (COLMAP)    0.73    2.39    6.82    2.1ms    2.1ms 

@vlarsson vlarsson left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Thanks for setting this up.

@vlarsson vlarsson merged commit d85d29c into PoseLib:master Jul 4, 2025
1 check passed
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.

Possible bug with Cauchy Loss

2 participants