Parse single epoch training curves
This commit is contained in:
@@ -183,7 +183,7 @@ def parse_training_curve(path: Path, max_points: int = 300) -> dict | None:
|
||||
y = _as_float(row.get(name))
|
||||
if y is not None:
|
||||
points.append({"x": x, "y": y})
|
||||
if len(points) >= 2:
|
||||
if points:
|
||||
values = [point["y"] for point in points]
|
||||
series.append({"name": name, "points": points, "last": values[-1], "min": min(values), "max": max(values)})
|
||||
if not series:
|
||||
|
||||
@@ -28,6 +28,26 @@ def test_parse_yolo_results_curve(tmp_path: Path):
|
||||
assert all("lr/" not in name for name in names)
|
||||
|
||||
|
||||
def test_parse_single_epoch_yolo_results_curve(tmp_path: Path):
|
||||
csv_path = tmp_path / "results.csv"
|
||||
csv_path.write_text(
|
||||
"\n".join(
|
||||
[
|
||||
"epoch,time,train/box_loss,train/seg_loss,metrics/mAP50(M),lr/pg0",
|
||||
"1,1.0,1.5,3.0,0.12,0.001",
|
||||
]
|
||||
),
|
||||
encoding="utf-8",
|
||||
)
|
||||
|
||||
curve = parse_training_curve(csv_path)
|
||||
|
||||
assert curve is not None
|
||||
assert curve["row_count"] == 1
|
||||
seg_loss = next(item for item in curve["series"] if item["name"] == "train/seg_loss")
|
||||
assert seg_loss["points"] == [{"x": 1.0, "y": 3.0}]
|
||||
|
||||
|
||||
def test_results_api_honors_limit(monkeypatch):
|
||||
calls = {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user