File size: 1,783 Bytes
c2b1b26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
"""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]