Complete the code to import the YOLO model from the ultralytics package.
from ultralytics import [1]
The YOLO model is imported from the ultralytics package using from ultralytics import YOLO.
Complete the code to load a pre-trained YOLOv8n model.
model = YOLO([1])To load the YOLOv8n pre-trained model, use the weights file 'yolov8n.pt'.
Fix the error in the code to run inference on an image using the YOLO model.
results = model.[1]('image.jpg')
The correct method to run inference on an image with the YOLO model is predict.
Fill both blanks to extract bounding boxes and confidence scores from YOLO results.
boxes = results.[1].xyxy confidences = results.[2].conf
The results.boxes contains the predictions including bounding boxes and confidence scores.
Fill all three blanks to run training on a custom dataset with YOLO.
model.train(data=[1], epochs=[2], imgsz=[3])
To train YOLO on a custom dataset, specify the data config file, number of epochs, and image size.