| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| |
|
| | #ifndef CONFIG_BA_H |
| | #define CONFIG_BA_H |
| | #include <vector> |
| |
|
| | namespace pba { |
| |
|
| | class ConfigBA { |
| | protected: |
| | enum { |
| | TIMER_OVERALL = 0, |
| | TIMER_OPTIMIZATION, |
| | TIMER_GPU_ALLOCATION, |
| | TIMER_GPU_UPLOAD, |
| | TIMER_PREPROCESSING, |
| | TIMER_GPU_DOWNLOAD, |
| | TIMER_CG_ITERATION, |
| | TIMER_LM_ITERATION, |
| | TIMER_FUNCTION_JJ, |
| | TIMER_FUNCTION_PJ, |
| | TIMER_FUNCTION_DD, |
| | TIMER_FUNCTION_JX, |
| | TIMER_FUNCTION_JTE, |
| | TIMER_FUNCTION_BC, |
| | TIMER_FUNCTION_MP, |
| | TIMER_FUNCTION_UP, |
| | TIMER_PROFILE_STEP, |
| | NUM_TIMER, |
| | FUNC_JX = 0, |
| | FUNC_JX_, |
| | FUNC_JTEC_JCT, |
| | FUNC_JTEC_JCO, |
| | FUNC_JTEP, |
| | FUNC_JTE_, |
| | FUNC_JJ_JCO_JCT_JP, |
| | FUNC_JJ_JCO_JP, |
| | FUNC_JJ_JCT_JP, |
| | FUNC_JJ_JP, |
| | FUNC_PJ, |
| | FUNC_BCC_JCT, |
| | FUNC_BCC_JCO, |
| | FUNC_BCP, |
| | FUNC_MPC, |
| | FUNC_MPP, |
| | FUNC_VS, |
| | FUNC_VV, |
| | NUM_FUNC |
| | }; |
| | class TimerBA { |
| | ConfigBA* _config; |
| | int _timer; |
| |
|
| | public: |
| | TimerBA(ConfigBA* config, int timer) { |
| | (_config = config)->BundleTimerStart(_timer = timer); |
| | } |
| | TimerBA(ConfigBA* config, int timer, bool) { |
| | (_config = config)->BundleTimerSwitch(_timer = timer); |
| | } |
| | ~TimerBA() { _config->BundleTimerSwitch(_timer); } |
| | }; |
| | friend class TimerBA; |
| |
|
| | public: |
| | |
| | int __lm_max_iteration; |
| | int __cg_max_iteration; |
| | int __cg_min_iteration; |
| | int __cg_recalculate_freq; |
| | bool __accurate_gain_ratio; |
| | |
| |
|
| | |
| | float __lm_delta_threshold; |
| | |
| | float __lm_gradient_threshold; |
| | float __lm_mse_threshold; |
| | |
| | float __lm_initial_damp; |
| | float __lm_minimum_damp; |
| | float __lm_maximum_damp; |
| | float __cg_norm_threshold; |
| | |
| | float __cg_norm_guard; |
| | int __pba_experimental; |
| | bool __cg_schur_complement; |
| |
|
| | |
| | bool __lm_check_gradient; |
| | float __lm_damping_auto_switch; |
| | bool __lm_use_diagonal_damp; |
| | |
| | |
| | bool __fixed_intrinsics; |
| | |
| | int __use_radial_distortion; |
| | |
| | bool __reset_initial_distortion; |
| | |
| |
|
| | |
| | int __verbose_level; |
| | bool __abort_flag; |
| | |
| | bool __verbose_cg_iteration; |
| | |
| | bool __verbose_function_time; |
| | |
| | bool __save_gradient_norm; |
| | bool __verbose_allocation; |
| | |
| | bool __verbose_sse; |
| |
|
| | |
| | bool __jc_store_transpose; |
| | bool __no_jacobian_store; |
| | bool __jc_store_original; |
| |
|
| | |
| | bool __jacobian_normalize; |
| | |
| | bool __focal_normalize; |
| | bool __depth_normalize; |
| | bool __depth_degeneracy_fix; |
| | float __data_normalize_median; |
| | float __depth_check_epsilon; |
| | |
| |
|
| | protected: |
| | bool __multiply_jx_usenoj; |
| | protected: |
| | |
| | int __selected_device; |
| | int __cpu_data_precision; |
| | int __bundle_time_budget; |
| | int __bundle_mode_next; |
| | int __bundle_current_mode; |
| | |
| | float __initial_mse; |
| | float __final_mse; |
| | float __final_mse_x; |
| | float __focal_scaling; |
| | float __depth_scaling; |
| | int __current_device; |
| | int __current_iteration; |
| | int __num_cg_iteration; |
| | int __num_lm_success; |
| | int __num_lm_iteration; |
| | int __num_projection_eval; |
| | int __num_jacobian_eval; |
| | int __num_camera_modified; |
| | int __num_point_behind; |
| | int __pba_return_code; |
| | int __recent_cg_status; |
| | int __profile_pba; |
| | bool __cpu_thread_profile; |
| | bool __debug_pba; |
| | bool __warmup_device; |
| | size_t __memory_usage; |
| | |
| | bool __matlab_format_stat; |
| | char* __stat_filename; |
| | const char* __driver_output; |
| | std::vector<float> __bundle_records; |
| | double __timer_record[NUM_TIMER]; |
| | int __num_cpu_thread_all; |
| | int __num_cpu_thread[NUM_FUNC]; |
| |
|
| | protected: |
| | ConfigBA(); |
| | |
| | void ResetTemporarySetting(); |
| | void ResetBundleStatistics(); |
| | void PrintBundleStatistics(); |
| | void SaveBundleStatistics(int ncam, int npt, int nproj); |
| | |
| | void BundleTimerStart(int timer); |
| | void BundleTimerSwitch(int timer); |
| | float BundleTimerGet(int timer); |
| | void BundleTimerSwap(int timer1, int timer2); |
| | float BundleTimerGetNow(int timer = TIMER_OPTIMIZATION); |
| | |
| | void SaveBundleRecord(int iter, float res, float damping, float gn, float gi); |
| | bool IsTimeBudgetAvailable(); |
| | double MyClock(); |
| |
|
| | public: |
| | void ParseParam(int argc, char** argv); |
| |
|
| | public: |
| | |
| | const char* GetOutputParam() { return __driver_output; } |
| | float GetInitialMSE() { return __initial_mse; } |
| | float GetFinalMSE() { return __final_mse; } |
| | double GetBundleTiming(int timer = TIMER_OVERALL) { |
| | return __timer_record[timer]; |
| | } |
| | int GetIterationsLM() { return __num_lm_iteration; } |
| | int GetIterationsCG() { return __num_cg_iteration; } |
| | int GetCurrentDevice() { return __current_device; } |
| | int GetBundleReturnCode() { return __pba_return_code; } |
| | int GetActiveDevice() { return __selected_device; } |
| | }; |
| |
|
| | } |
| |
|
| | #endif |
| |
|