Ceres Solver 中文文档
  • 😜Ceres Solver 中文文档
  • Why Ceres ?
  • Installation
  • Tutorial
    • Non-linear Least Squares
      • Introduction
      • Hello World
      • Derivatives
        • Numeric Derivatives
        • Analytic Derivatives
        • More About Derivatives
      • Powell’s Function
      • Curve Fitting
      • Robust Curve Fitting
      • Bundle Adjustment
      • Other Examples
    • General Unconstrained Minimization
      • General Unconstrained Minimization
  • On Derivatives
    • Spivak Notation
    • Analytic Derivatives
    • Numeric Derivatives
    • Automatic Derivatives
    • Interfacing with Automatic Differentiation
    • Using Inverse & Implicit Function Theorems
  • Modeling Non-linear Least Squares
    • Introduction
    • Main Class Interface
      • CostFunction
      • SizeCostFunction
      • AutoDiffCostFunction
      • DynamicAutoDiffCostFunction
      • NumericDiffCostFunction
      • DynamicNumericDifferCostFunction
      • CostFunctionToFunctor
      • DynamicCostFunctionToFunctor
      • ConditionedCostFunction
      • GradientChecker
      • NormalPrior
      • LossFunction
      • Manifold
      • AutoDIffManifold
      • Problem
      • EvaluatationCallback
      • Rotation
      • Cubic Interpolation
        • CubicInterpolator
        • BiCubicInterpolator
  • Solveing Non-linear Least Squares
    • Introduction
    • Trust Region Methodd
    • Line Search Methods
    • Linear Solvers
    • Mixed Precision Solves
    • Preconditioners
    • Ordering
    • Main Class Interfaces
      • Solver::Options
      • ParameterBlockOrdering
      • IterationSummary
      • IterationCallback
      • CRSMatrix
      • Solver::Summary
  • Covariance Estimation
    • Introduction
    • Gauge Invariance
    • Covariance
    • Rank of the Jacobian
      • Options
      • Covariance
      • GetCovarianceBlock
      • GetCovarianceBlockInTangentSpace
    • Example Usage
Powered by GitBook
On this page
  1. Tutorial
  2. Non-linear Least Squares

Robust Curve Fitting

PreviousCurve FittingNextBundle Adjustment

Last updated 1 year ago

现在,假设我们得到的数据中有一些异常值,即有一些点不符合噪声模型。如果用上一小节的代码来拟合这些数据,我们会得到如下拟合结果。请注意拟合曲线与真实曲线的偏差。

处理离群值的方法是使用损失函数(LossFunction)。损失函数可以减少残差较高的残差块的影响,这些残差块通常与异常值相对应。要将损失函数与残差块关联起来,我们需要改变

problem.AddResidualBlock(cost_function, nullptr , &m, &c);

改为

problem.AddResidualBlock(cost_function, new CauchyLoss(0.5) , &m, &c);

CauchyLoss 是 Ceres Solver 附带的损失函数之一。参数 0.5 指定损失函数的比例。加入损失函数后,我们得到了下面的拟合结果。请注意拟合曲线是如何向真实曲线靠拢的。

Footnotes

examples/robust_curve_fitting.cc
Non Robust Least Squares Curve Fitting
Robust Least Squares Curve Fitting