34 lines
750 B
Python
34 lines
750 B
Python
'''
|
|
Author: lrren01
|
|
Date: 2024-07-01 11:05:47
|
|
LastEditors: renlirong
|
|
LastEditTime: 2024-09-13 11:26:46
|
|
Description: Fine Tunning
|
|
'''
|
|
import time
|
|
from ultralytics import YOLOv10
|
|
|
|
start_time = time.time()
|
|
|
|
model = YOLOv10("runs/detect/train/weights/best.pt")
|
|
|
|
# train
|
|
model.train(data="datasets/page_seg/icon.yaml",
|
|
epochs=100,
|
|
batch=10,
|
|
device="cuda:1",
|
|
lr0=0.0001,
|
|
# freeze=10
|
|
)
|
|
|
|
|
|
metrics = model.val()
|
|
|
|
success = model.export(format="onnx")
|
|
|
|
end_time = time.time()
|
|
total_time = end_time - start_time
|
|
hours, remainder = divmod(total_time, 3600)
|
|
minutes, seconds = divmod(remainder, 60)
|
|
|
|
print(f"Process Time: {int(hours)}Hours {int(minutes)}Minutes {int(seconds)}Seconds") |