Skip to content

Cross Validate

SUMMARY

cross_validate() computes the mean reprojection error over n_splits held-out folds of a set of images, the core metric behind run()'s held_out_reprojection_error.

SUPPORTED TARGETS

Works with any target, ChessboardTarget, CharucoTarget, or ArucoTarget, it only runs intrinsic calibration per fold.

UNITS

Input images are BGR ndarrays. Returns the mean held-out reprojection error as a float in pixels.

The Skill

python
error = bench.cross_validate(images, target, options, n_splits=5, seed=0)
SkillReturnsDescription
cross_validate(images, target, options, n_splits=5, seed=0)floatMean reprojection error over n_splits held-out folds of images.
ParameterTypeDescription
imageslist[ndarray]BGR calibration images to split into folds.
targetTargetCalibration target to detect.
optionsIntrinsicOptionsIntrinsic solve configuration, see IntrinsicOptions.
n_splitsintNumber of cross-validation folds. Default 5.
seedintMakes the fold shuffle deterministic across runs. Default 0.

The Code

python
from telekinesis.axon import CalibrationBenchmark, IntrinsicOptions
from telekinesis.axon.targets import CharucoTarget

target = CharucoTarget(squares_x=6, squares_y=9, square_length=0.012, marker_length=0.009)

bench = CalibrationBenchmark()
error = bench.cross_validate(images, target, IntrinsicOptions(), n_splits=5, seed=0)