train_yolo_v8_classification

train_yolo_v8_classification

About

1.1.1
AGPL-3.0

Train YOLOv8 classification models.

Task: Classification
YOLO
classification
ultralytics
imagenet

Train YOLOv8 classification models.

dog classification

🚀 Use with Ikomia API

1. Install Ikomia API

We strongly recommend using a virtual environment. If you're not sure where to start, we offer a tutorial here.

pip install ikomia

2. Create your workflow

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()

# Add dataset loader
data_loader = wf.add_task(name="dataset_classification")
data_loader.set_parameters({"dataset_folder": "path/to/dataset/folder"})

# Add training algorithm
train = wf.add_task(name="train_yolo_v8_classification", auto_connect=True)

# Launch your training on your data
wf.run()

☀️ Use with Ikomia Studio

Ikomia Studio offers a friendly UI with the same features as the API.

  • If you haven't started using Ikomia Studio yet, download and install it from this page.

  • For additional guidance on getting started with Ikomia Studio, check out this blog post.

📝 Set algorithm parameters

  • model_name (str) - default 'yolov8m-cls': Name of the YOLOv8 pre-trained model. Other model available:

    • yolov8n-cls
    • yolov8s-cls
    • yolov8l-cls
    • yolov8x-cls
  • batch_size (int) - default '8': Number of samples processed before the model is updated.

  • epochs (int) - default '100': Number of complete passes through the training dataset.

  • dataset_split_ratio (float) – default '0.9': Divide the dataset into train and evaluation sets ]0, 1[.

  • input_size (int) - default '640': Size of the input image.

  • weight_decay (float) - default '0.0005': Amount of weight decay, regularization method.

  • momentum (float) - default '0.937': Optimization technique that accelerates convergence.

  • workers (int) - default '0': Number of worker threads for data loading (per RANK if DDP).

  • optimizer (str) - default '0.937': Optimizer to use, choices=[SGD, Adam, Adamax, AdamW, NAdam, RAdam, RMSProp, auto]

  • lr0 (float) - default '0.01': Initial learning rate (i.e. SGD=1E-2, Adam=1E-3)

  • lr1 (float) - default '0.01': Final learning rate (lr0 * lrf)

  • output_folder (str, optional): path to where the model will be saved.

  • config_file (str, optional): path to the training config file .yaml.

Parameters should be in strings format when added to the dictionary.

from ikomia.dataprocess.workflow import Workflow

# Init your workflow
wf = Workflow()

# Add dataset loader
data_loader = wf.add_task(name="dataset_classification")
data_loader.set_parameters({"dataset_folder": "path/to/dataset/folder"})

# Add training algorithm
train = wf.add_task(name="train_yolo_v8_classification", auto_connect=True)
train.set_parameters({
"model_name": "yolov8n-cls",
"epochs": "50",
"batch_size": "8",
"input_size": "640",
"dataset_split_ratio": "0.9",
"weight_decay": "0.0005",
"momentum": "0.937",
"workers": "0",
"optimizer": "auto",
"lr0": "0.01",
"lr1": "0.01"
})

# Launch your training on your data
wf.run()

Developer

  • Ikomia
    Ikomia

License

GNU Affero General Public License v3.0
Read license full text

Permissions of this strongest copyleft license are conditioned on making available complete source code of licensed works and modifications, which include larger works using a licensed work, under the same license. Copyright and license notices must be preserved. Contributors provide an express grant of patent rights. When a modified version is used to provide a service over a network, the complete source code of the modified version must be made available.

PermissionsConditionsLimitations

Commercial use

License and copyright notice

Liability

Modification

State changes

Warranty

Distribution

Disclose source

Patent use

Network use is distribution

Private use

Same license

This is not legal advice: this description is for informational purposes only and does not constitute the license itself. Provided by choosealicense.com.