-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
32 lines (24 loc) · 677 Bytes
/
test.py
File metadata and controls
32 lines (24 loc) · 677 Bytes
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
from ultralytics import YOLO
MODEL_PATH = ""
DATA_YAML = ""
SAVE_PATH=""
def test_step_YOLO(model_path, data_yaml, save_path, input_size=640, batch_size=16, device=0, workers=1):
"""
Evaluate YOLO model on test dataset.
"""
# Load model
model = YOLO(model_path)
# Run evaluation
metrics = model.val(
data=data_yaml,
imgsz=input_size,
batch=batch_size,
split="test",
device=device,
workers=workers,
project=save_path,
name="test_results"
)
return metrics
if __name__ == "__main__":
test_step_YOLO(MODEL_PATH, DATA_YAML, SAVE_PATH)