36 lines
702 B
Python
36 lines
702 B
Python
"""
|
|
Author: lrren01
|
|
Date: 2024-07-01 11:05:47
|
|
LastEditors: lrren01
|
|
LastEditTime: 2024-09-13 11:17:37
|
|
Description: Run Model
|
|
"""
|
|
|
|
import time
|
|
from ultralytics import YOLO
|
|
|
|
start_time = time.time()
|
|
|
|
model = YOLO("runs/detect/train/weights/best.pt") # Model Path
|
|
|
|
# train
|
|
model.train(
|
|
data="datasets/page_seg/icon.yaml", # Dataset Path
|
|
epochs=100,
|
|
batch=10,
|
|
device="cuda:1",
|
|
lr0=0.0001,
|
|
)
|
|
|
|
|
|
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")
|