Exploring the YOLO Command-Line Interface (with examples)
Introduction
The YOLO (You Only Look Once) command-line interface is a powerful tool that allows users to train, validate, or infer models on various computer vision tasks. In this article, we will explore three different use cases of the YOLO command-line interface, along with their corresponding code examples, motivations, explanations, and example outputs.
Use Case 1: Creating a Copy of the Default Configuration
Code:
yolo task=init
Motivation:
When using the YOLO command-line interface, it is often necessary to have a configuration file that defines the model architecture, dataset paths, hyperparameters, etc. This use case demonstrates how to create a copy of the default configuration file to customize it for your specific task.
Explanation:
yolo
: The main command to invoke the YOLO command-line interface.task=init
: Specifies the task to initialize a new configuration file.
Example Output:
Created default configuration file: /path/to/your/current/working/directory/config.yaml
Use Case 2: Training an Object Detection, Instance Segmentation, or Classification Model
Code:
yolo task=detect|segment|classify mode=train cfg=path/to/config.yaml
Motivation:
To develop a successful computer vision model, it is essential to train the model using labeled data. This use case demonstrates how to train an object detection, instance segmentation, or classification model using the YOLO command-line interface.
Explanation:
yolo
: The main command to invoke the YOLO command-line interface.task=detect|segment|classify
: Specifies the task type, which can be either object detection (detect
), instance segmentation (segment
), or classification (classify
).mode=train
: Specifies the mode to train the model.cfg=path/to/config.yaml
: Specifies the path to the configuration file generated in the previous use case.
Example Output:
Starting training...
Epoch: [1/10] Loss: 1.234
Epoch: [2/10] Loss: 0.987
Epoch: [3/10] Loss: 0.756
...
Training completed successfully!
Conclusion
The YOLO command-line interface provides a user-friendly and efficient way to train, validate, or infer computer vision models. The examples presented in this article demonstrate how to create a copy of the default configuration file and train a model using the YOLO command-line interface. By utilizing the YOLO command-line interface, researchers and developers can easily experiment with different configurations and tasks while harnessing the power of YOLO models.