评估
评估
概述
测试
CLI
Command Line
1luxonis_train test --config configs/detection_light_model.yaml \
2 --view val \
3 --weights path/to/checkpoint.ckptPython API
Python
1from luxonis_train import LuxonisModel
2
3model = LuxonisModel("configs/detection_light_model.yaml")
4model.test(weights="path/to/checkpoint.ckpt")注意: 可以使用 TestOnTrainEnd 回调在训练结束时自动开始测试过程。
推理
CLI
对数据集视图进行推理
Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2 --view val \
3 --weights path/to/checkpoint.ckpt对视频文件进行推理
Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2 --weights path/to/checkpoint.ckpt \
3 --source-path path/to/video.mp4对图像目录进行推理
Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2 --weights path/to/checkpoint.ckpt \
3 --source-path path/to/images对单个图像进行推理
Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2 --weights path/to/checkpoint.ckpt \
3 --source-path path/to/image.jpgPython API
Python
1from luxonis_train import LuxonisModel
2
3model = LuxonisModel("configs/detection_light_model.yaml")
4
5# 对数据集视图进行推理
6model.infer(weights="path/to/checkpoint.ckpt", view="val")
7
8# 对视频文件进行推理
9model.infer(weights="path/to/checkpoint.ckpt", source_path="path/to/video.mp4")
10
11# 对图像目录进行推理并保存结果
12model.infer(
13 weights="path/to/checkpoint.ckpt",
14 source_path="path/to/images",
15 save_dir="path/to/save_directory",
16)注释
CLI
Command Line
1luxonis_train annotate --config configs/detection_light_model.yaml \
2 --weights path/to/checkpoint.ckpt \
3 --source-path path/to/imagesPython API
Python
1from luxonis_train import LuxonisModel
2
3model = LuxonisModel("configs/detection_light_model.yaml")
4dataset = model.annotate(
5 dir_path="path/to/images",
6 dataset_name="annotated_dataset",
7 weights="path/to/checkpoint.ckpt",
8)LuxonisDataset 的形式返回,因此可以对其进行检查、导出或直接在后续的训练运行中重复使用。通过同时使用测试和推理,您可以全面了解模型的性能,并进行必要的调整以提高其准确性和可靠性。