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)| Skill | Returns | Description |
|---|---|---|
cross_validate(images, target, options, n_splits=5, seed=0) | float | Mean reprojection error over n_splits held-out folds of images. |
| Parameter | Type | Description |
|---|---|---|
images | list[ndarray] | BGR calibration images to split into folds. |
target | Target | Calibration target to detect. |
options | IntrinsicOptions | Intrinsic solve configuration, see IntrinsicOptions. |
n_splits | int | Number of cross-validation folds. Default 5. |
seed | int | Makes 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)