Spaces:
Sleeping
Sleeping
File size: 620 Bytes
097f176 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import yaml
from ultralytics import YOLO
def main():
file_path = "runs/detect/tune4/best_hyperparameters.yaml"
with open(file_path, 'r') as file:
hyperparameters = yaml.safe_load(file)
print(hyperparameters)
model = YOLO('yolov8s.pt')
model.train(
data='dataset.yaml',
**hyperparameters,
imgsz=768,
batch=16,
device=0,
optimizer='adamw',
plots=True,
save=True,
conf=0.25,
iou=0.45,
epochs=200,
patience=20
)
if __name__ == "__main__":
main()
|