Views
No views yet

1from ultralytics import YOLO
2
3# Use pretrained Yolo segmentation model
4model = YOLO('yolov8x.pt')
5
6# Path to .yaml file where data location and object classes are defined
7yaml_path = 'intersections.yaml'
8
9# Start model training with the defined parameters
10model.train(data=yaml_path, name='model_name', epochs=100, imgsz=640, workers=4, optimizer='SGD',
11 lr0=0.01, seed=42, val=True, cos_lr=False, patience=10, batch=32, device='0,1')| Class | Images | Class instances | Box precision | Box recall | Box mAP50 | Box mAP50-95 |
|---|---|---|---|---|---|---|
| Intersection | 31 | 6769 | 0.927 | 0.946 | 0.939 | 0.426 |
yolo_kuolleet_09022024.pt is downloaded to a folder \models\yolo_kuolleet_09022024.pt
and the input image path is \data\image.jpg, inference can be perfomed using the following code:1from ultralytics import YOLO
2
3# Initialize model
4model = YOLO(`\models\yolo_kuolleet_09022024.pt`)
5prediction_results = model.predict(source=`\data\image.jpg', save=True)