ON THIS PAGE

  • Evaluation
  • Overview
  • Testing
  • CLI
  • Python API
  • Inference
  • CLI
  • Inference on a Dataset View
  • Inference on a Video File
  • Inference on an Image Directory
  • Inference on a single Image
  • Python API

Evaluation

Overview

LuxonisTrain provides tools to evaluate your trained models effectively. This means you can both test the model to gather performance metrics and infer to visually inspect model predictions.

Testing

To evaluate the performance of your model, you can run various tests to get metrics such as accuracy, precision, recall, and more. These metrics help you understand how well your model is performing on your test dataset.You can evaluate your trained model on different dataset views, such as train, validation (val), or test, to get a comprehensive understanding of its performance.The results of the testing will be also logged to the place specified under the tracking section in the configuration file.

CLI

Command Line
1luxonis_train test --config configs/detection_light_model.yaml \
2                   --view val                                  \
3                   --weights path/to/checkpoint.ckpt

Python API

Python
1from luxonis_train import LuxonisModel
2
3model = LuxonisModel("configs/detection_light_model.yaml")
4model.test(weights="path/to/checkpoint.ckpt")
Note: The testing process can be started automatically at the end of the training by using the TestOnTrainEnd callback.

Inference

Inferring involves using the model to make predictions on new data. This allows you to visually inspect how well the model performs and observe the predictions it generates.To run inference on images, datasets, or videos using LuxonisTrain, you can use either the CLI or the Python API to perform inference with your trained models.

CLI

Inference on a Dataset View

Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2                    --view val                                  \
3                    --weights path/to/checkpoint.ckpt

Inference on a Video File

Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2                    --weights path/to/checkpoint.ckpt           \
3                    --source-path path/to/video.mp4

Inference on an Image Directory

Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2                    --weights path/to/checkpoint.ckpt           \
3                    --source-path path/to/images

Inference on a single Image

Command Line
1luxonis_train infer --config configs/detection_light_model.yaml \
2                    --weights path/to/checkpoint.ckpt           \
3                    --source-path path/to/image.jpg

Python API

Python
1from luxonis_train import LuxonisModel
2
3model = LuxonisModel("configs/detection_light_model.yaml")
4
5# Infer on a dataset view
6model.infer(weights="path/to/checkpoint.ckpt", view="val")
7
8# Infer on a video file
9model.infer(weights="path/to/checkpoint.ckpt", source_path="path/to/video.mp4")
10
11# Infer on an image directory and save the results
12model.infer(
13    weights="path/to/checkpoint.ckpt",
14    source_path="path/to/images",
15    save_dir="path/to/save_directory",
16)
By using both testing and inference, you can gain comprehensive insights into your model's performance and make necessary adjustments to improve its accuracy and reliability.