class mp2p_icp::LearnedCovariance

Overview

A small ensemble of MLPs that corrects the analytic covariance of CovFeatureEvaluator in its whitened space:

Sigma = L_a M L_a^T, M = L_m L_m^T,

with L_m lower triangular (log-diagonal and off-diagonal entries are the network outputs). The ensemble’s covariance is the mean of its members’, and it also outputs a probability that the registration failed.

Inference only, plain Eigen. The model is a little-endian binary file (magic “MP2PLCOV”, format version 2) written by the training scripts; see load() for its layout.

#include <LearnedCovariance.h>

class LearnedCovariance
{
public:
    // structs

    struct Layer;
    struct Output;

    // methods

    void load(const std::string& file);
    bool loaded() const;
    const std::string& note() const;
    Output predict(const CovFeatureResult& r, const std::map<std::string, std::string>& context) const;
    size_t numMembers() const;
};

Methods

void load(const std::string& file)

Loads a model file. Throws on a format error, or if the model was trained on features this CovFeatureEvaluator does not compute; then the previously loaded model, if any, is kept.

The file records the feature version, not the CovFeatureParameters : use the evaluator with the parameters the model was trained with.

Layout (little-endian; str = u32 length + bytes): char[8] “MP2PLCOV”; u32 format version (2); u32 feature version; str note; u32 nf, nf x {str name; f64 median, mean, std}; u32 nn, nn x str (features with a missing-value indicator); u32 nc, nc x {str key; u32 nv; nv x str} (context one-hots); f64 clip; f64 layernorm_eps; u32 members, per member u32 layers, per layer u8 kind: 0 linear {u32 rows, cols; f32 W[rows*cols] row-major; f32 b[rows]}, 1 layernorm + GELU {u32 n; f32 gain[n]; f32 bias[n]}.

const std::string& note() const

Free text stored in the model file (training data, date, …).

Output predict(const CovFeatureResult& r, const std::map<std::string, std::string>& context) const

Predicts the covariance of a registration from the evaluator’s result and the context labels the model was trained with (e.g. {“framework_name”: “mp2p_gicp”, “sensor”: “…”, “mode”: “s2m”}). Unknown context values contribute all-zero one-hots. Requires r.ok. Throws if the prediction is not finite.