ceres中的loss函数实现探查,包括Huber,Cauchy,Tolerant图像实现及源码

ceres中的loss函数实现探查,包括Huber,Cauchy,Tolerant图像实现及源码在这里插入图片描述

各个损失函数的趋势图:
在这里插入图片描述

Ceres内嵌的loss functions原理:
在这里插入图片描述

以CauchyLoss方法为例,其头文件为:

// Inspired by the Cauchy distribution
//   rho(s) = log(1 + s).
// At s = 0: rho = [0, 1, -1].
class CERES_EXPORT CauchyLoss : public LossFunction {
 public:
  explicit CauchyLoss(double a) : b_(a * a), c_(1 / b_) {}
  void Evaluate(double, double*) const override;
//可以看出CauchyLoss()中的参数为尺度参数。
 private:
  // b = a^2.
  const double b_;
  // c = 1 / a^2.
  const double c_;
};

具体实现为:

void CauchyLoss::Evaluate(double s, double rho[3]) const {
  const double sum = 1.0 + s * c_;
  const double inv = 1.0 / sum;
  // 'sum' and 'inv' are always positive, assuming that 's' is.
  rho[0] = b_ * log(sum);
  rho[1] = std::max(std::numeric_limits<double>::min(), inv);
  rho[2] = - c_ * (inv * inv);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值