fix: resolve model weight paths against DATA_DIR (REQ-187)

- config.py: resolve_data_path (legacy abs + rel) + rel_data_path
- all file-opening reads wrapped: preview, autolabel, training, model
  download, live count, projects.get; training_start_point hack replaced
- new writes store paths relative to data/
- legacy stale rows (/home/asus/reTraining/...) resolve without migration
- requirements: REQ-187 added; REQ-188 (per-class max box) + REQ-186
  copy-line amendment drafted for the next task
This commit is contained in:
asus committed 2026-10-02 16:59:25 +07:00
1 parent 8f41c6c85a
commit dee58e4ae5
10 files changed
+93 -32

No files matched your search

+5 -3
View File
@@ -10,7 +10,7 @@ import os
from typing import List, Optional
from PIL import Image
from backend import batches, db, jobs, labeling, projects, review
from backend import batches, config, db, jobs, labeling, projects, review
from backend.batches import BatchError
DEFAULT_THRESHOLD = 0.35
@@ -158,8 +158,10 @@ def _run_autolabel(job) -> None:
with db.cursor() as cur:
cur.execute("SELECT weights_path FROM model_versions WHERE project_id = ? ORDER BY version DESC LIMIT 1", (project["id"],))
row = cur.fetchone()
if row and os.path.isfile(row[0]):
m_path = row[0]
if row:
resolved = config.resolve_data_path(row[0])
if os.path.isfile(resolved):
m_path = resolved
job.log(f"Loading Base Model: {os.path.basename(m_path)}...")
yolo_model = YOLO(m_path)