phase cv 0
This commit is contained in:
@@ -9,6 +9,19 @@ from .base import (
|
||||
)
|
||||
from .soccer import SoccerBroadcastProfile
|
||||
|
||||
_PROFILES: dict[str, type] = {
|
||||
"soccer_broadcast": SoccerBroadcastProfile,
|
||||
}
|
||||
|
||||
|
||||
def get_profile(name: str) -> ContentTypeProfile:
|
||||
"""Get a profile instance by name."""
|
||||
cls = _PROFILES.get(name)
|
||||
if cls is None:
|
||||
raise ValueError(f"Unknown profile: {name!r}. Available: {list(_PROFILES)}")
|
||||
return cls()
|
||||
|
||||
|
||||
__all__ = [
|
||||
"ContentTypeProfile",
|
||||
"CropContext",
|
||||
@@ -18,4 +31,5 @@ __all__ = [
|
||||
"ResolverConfig",
|
||||
"SceneFilterConfig",
|
||||
"SoccerBroadcastProfile",
|
||||
"get_profile",
|
||||
]
|
||||
|
||||
@@ -44,6 +44,19 @@ class ResolverConfig:
|
||||
fuzzy_threshold: int = 75
|
||||
|
||||
|
||||
@dataclass
|
||||
class RegionAnalysisConfig:
|
||||
enabled: bool = True
|
||||
# Edge detection (Canny + HoughLinesP)
|
||||
edge_canny_low: int = 50
|
||||
edge_canny_high: int = 150
|
||||
edge_hough_threshold: int = 80
|
||||
edge_hough_min_length: int = 100
|
||||
edge_hough_max_gap: int = 10
|
||||
edge_pair_max_distance: int = 200
|
||||
edge_pair_min_distance: int = 15
|
||||
|
||||
|
||||
@dataclass
|
||||
class CropContext:
|
||||
image: bytes
|
||||
@@ -56,6 +69,7 @@ class ContentTypeProfile(Protocol):
|
||||
|
||||
def frame_extraction_config(self) -> FrameExtractionConfig: ...
|
||||
def scene_filter_config(self) -> SceneFilterConfig: ...
|
||||
def region_analysis_config(self) -> RegionAnalysisConfig: ...
|
||||
def detection_config(self) -> DetectionConfig: ...
|
||||
def ocr_config(self) -> OCRConfig: ...
|
||||
def resolver_config(self) -> ResolverConfig: ...
|
||||
|
||||
@@ -9,6 +9,7 @@ from .base import (
|
||||
DetectionConfig,
|
||||
FrameExtractionConfig,
|
||||
OCRConfig,
|
||||
RegionAnalysisConfig,
|
||||
ResolverConfig,
|
||||
SceneFilterConfig,
|
||||
)
|
||||
@@ -23,6 +24,17 @@ class SoccerBroadcastProfile:
|
||||
def scene_filter_config(self) -> SceneFilterConfig:
|
||||
return SceneFilterConfig(hamming_threshold=8, enabled=True)
|
||||
|
||||
def region_analysis_config(self) -> RegionAnalysisConfig:
|
||||
return RegionAnalysisConfig(
|
||||
edge_canny_low=50,
|
||||
edge_canny_high=150,
|
||||
edge_hough_threshold=80,
|
||||
edge_hough_min_length=100,
|
||||
edge_hough_max_gap=10,
|
||||
edge_pair_max_distance=200,
|
||||
edge_pair_min_distance=15,
|
||||
)
|
||||
|
||||
def detection_config(self) -> DetectionConfig:
|
||||
return DetectionConfig(
|
||||
model_name="yolov8n.pt",
|
||||
|
||||
Reference in New Issue
Block a user