906804140c
Renames image_record.wd14_* -> tagger_* (we're on Camie now, not WD14). Adds tag_allowlist (auto-apply opt-in, per-tag confidence), tag_suggestion_rejection (per-image dismissals), tag_alias (composite (string, category) -> canonical tag, resolved at read time), tag_reference_embedding (per-tag SigLIP centroids), and the ml_settings singleton (per-category + centroid thresholds, model version pins). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
43 lines
1.5 KiB
Python
43 lines
1.5 KiB
Python
"""MLSettings — single-row table holding ML pipeline tunables."""
|
|
|
|
from datetime import datetime
|
|
|
|
from sqlalchemy import CheckConstraint, DateTime, Float, Integer, String, func
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
|
|
from .base import Base
|
|
|
|
|
|
class MLSettings(Base):
|
|
__tablename__ = "ml_settings"
|
|
__table_args__ = (CheckConstraint("id = 1", name="ck_ml_settings_singleton"),)
|
|
|
|
id: Mapped[int] = mapped_column(Integer, primary_key=True)
|
|
suggestion_threshold_artist: Mapped[float] = mapped_column(
|
|
Float, nullable=False, default=0.30
|
|
)
|
|
suggestion_threshold_character: Mapped[float] = mapped_column(
|
|
Float, nullable=False, default=0.50
|
|
)
|
|
suggestion_threshold_copyright: Mapped[float] = mapped_column(
|
|
Float, nullable=False, default=0.50
|
|
)
|
|
suggestion_threshold_general: Mapped[float] = mapped_column(
|
|
Float, nullable=False, default=0.95
|
|
)
|
|
centroid_similarity_threshold: Mapped[float] = mapped_column(
|
|
Float, nullable=False, default=0.55
|
|
)
|
|
min_reference_images: Mapped[int] = mapped_column(
|
|
Integer, nullable=False, default=5
|
|
)
|
|
tagger_model_version: Mapped[str] = mapped_column(
|
|
String(128), nullable=False, default="camie-tagger-v2"
|
|
)
|
|
embedder_model_version: Mapped[str] = mapped_column(
|
|
String(128), nullable=False, default="siglip-so400m-patch14-384"
|
|
)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), nullable=False, server_default=func.now()
|
|
)
|