36 lines
708 B
Python
36 lines
708 B
Python
'''
|
|
Author: lrren01
|
|
Date: 2024-07-01 11:05:47
|
|
LastEditors: renlirong
|
|
LastEditTime: 2024-09-13 11:26:07
|
|
Description: Run Model
|
|
'''
|
|
import time
|
|
from ultralytics import YOLOv10
|
|
|
|
start_time = time.time()
|
|
|
|
model = YOLOv10("yolov10x.pt")
|
|
|
|
# train
|
|
model.train(data="datasets/page_seg/page_all.yaml",
|
|
epochs=200,
|
|
batch=10,
|
|
device="cuda:3",
|
|
lr0=0.01,
|
|
)
|
|
|
|
|
|
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")
|
|
|
|
|