View source
Download
.ipynb
Train a YOLO classifier with 3LC metrics collection¶
Train a YOLO classifer using existing tables.

Install dependencies¶
[ ]:
%pip install 3lc
%pip install 3lc-ultralytics
Imports¶
[ ]:
import tlc
from tlc_ultralytics import YOLO, Settings
Project setup¶
[ ]:
PROJECT_NAME = "3LC Tutorials - CIFAR-10"
MODEL_NAME = "yolov8n-cls.pt"
IMAGE_COLUMN = "Image"
LABEL_COLUMN = "Label"
EPOCHS = 5
NUM_WORKERS = 0
BATCH_SIZE = 32
IMAGE_SIZE = 32
DOWNLOAR_PATH = "../../transient_data"
[ ]:
train_table = tlc.Table.from_names("initial", "CIFAR-10-train", PROJECT_NAME)
val_table = tlc.Table.from_names("initial", "CIFAR-10-val", PROJECT_NAME)
[ ]:
model = YOLO(MODEL_NAME)
settings = Settings(
project_name=PROJECT_NAME,
run_name="Train YOLO Classifier",
image_embeddings_dim=2,
conf_thres=0.2,
sampling_weights=True,
exclude_zero_weight_training=True,
exclude_zero_weight_collection=False,
image_column_name=IMAGE_COLUMN,
label_column_name=LABEL_COLUMN,
)
model.train(
tables={
"train": train_table,
"val": val_table,
},
settings=settings,
batch=BATCH_SIZE,
imgsz=IMAGE_SIZE,
epochs=EPOCHS,
workers=NUM_WORKERS,
project=DOWNLOAR_PATH,
)