"""Seed labels and metadata helpers for registry-driven marine feature tasks.""" from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True) class SeedLabel: id: int name: str description: str role: str SEED_CONTEXT_LABELS = [ SeedLabel(0, "other", "valid background or unlabeled non-target area", "context"), SeedLabel(1, "invalid", "black border, no-data, saturated, missing, or unusable pixels", "validity"), SeedLabel(2, "water", "valid water background", "context"), SeedLabel(3, "land", "land or non-water hard negative", "context"), SeedLabel(4, "cloud_shadow", "cloud, haze, cloud shadow, or atmospheric interference", "context"), ] SEED_ELEMENT_CARDS = { "green_tide": "Enteromorpha / green tide / seaweed", "red_tide": "red tide / harmful algal bloom", "golden_tide": "Sargassum / golden tide", "aquaculture": "aquaculture areas, rafts, cages, ponds, or facilities", "ship": "ship or vessel target", "oil_spill": "oil film or suspected oil-spill area", "sea_ice": "sea ice or ice-water boundary", } TASK_TYPES = { "semantic_segmentation", "instance_segmentation", "detection", "polygon_extraction", "change_detection", "anomaly_detection", } DEFAULT_BANDS_4CH = ["blue", "green", "red", "nir"] FUSION_STATES = {"none", "fused_product", "runtime_fusion", "unknown"} LABEL_NAME_TO_ID = {item.name: item.id for item in SEED_CONTEXT_LABELS} LABEL_ID_TO_NAME = {item.id: item.name for item in SEED_CONTEXT_LABELS} def is_seed_element(name: str) -> bool: return name in SEED_ELEMENT_CARDS def is_fusion_state(value: str) -> bool: return value in FUSION_STATES def context_label_id(name: str) -> int: return LABEL_NAME_TO_ID[name]