VideoAnnotation / core /tapi_ontology.py
swapnakumbar12's picture
Create core/tapi_ontology.py
d95be67 verified
Raw
History Blame Contribute Delete
7.59 kB
"""
Tapi Tag Ontology β€” Phase II
Complete label registry extracted from the official SOP PDF (all 12 pages).
"""
# ── Environment ───────────────────────────────────────────────
WEATHER_LABELS = {"clear", "cloudy", "rainy", "snowy", "foggy"}
TIME_OF_DAY_LABELS = {"nighttime", "daytime", "dusk", "dawn"}
VISIBILITY_LABELS = {
"clear",
"sun glare",
"headlight glare",
"poor visibility from weather",
}
# ── Setting ───────────────────────────────────────────────────
SETTING_AREA_LABELS = {"urban", "residential", "rural", "industrial", "highway"}
SETTING_INFRASTRUCTURE_LABELS = {
"buildings", "gas station", "sound barrier", "construction site",
}
SETTING_NATURE_LABELS = {"trees", "river", "lake"}
# ── Road Topology ─────────────────────────────────────────────
ROAD_PROPERTY_LABELS = {
"median-separated", "wet", "snow", "hilly",
"hov", "winding", "debris", "pothole",
}
# ── Events ───────────────────────────────────────────────────
EVENT_LABELS = {
"green becomes yellow",
"yellow becomes red",
"red becomes green",
}
# ── Movements – Ego ──────────────────────────────────────────
EGO_MOVEMENT_LABELS = {
"ego drives on ego lane",
"ego brakes in ego lane",
"ego changes lane right out of ego lane",
"ego changes lane left out of ego lane",
"ego drives behind vehicle",
"ego drives left vehicle",
"ego drives right vehicle",
"ego drives on bridge",
"ego drives through intersection",
"ego drives through tunnel",
"ego drives under bridge",
"ego drives over speed bump",
"ego merges into highway exit",
"ego merges out of highway exit",
"ego merges into highway entrance",
"ego merges out of highway entrance",
"ego merges into rotary",
"ego merges out of rotary",
"ego passes left vehicle",
"ego passes left pedestrian",
"ego passes right vehicle",
"ego passes right pedestrian",
"ego parked in ego lane",
"ego parked on sidewalk",
"ego parked on shoulder",
"ego turns left at intersection",
"ego turns right at intersection",
"ego turns left at fork",
"ego turns right at fork",
"ego waits at signals",
"ego waits at signs",
"ego waits at crosswalk",
"ego waits at intersection",
"ego waits behind vehicle",
"ego waits behind bicyclist",
"ego parking",
"ego merges into road",
}
# ── Movements – Vehicle ──────────────────────────────────────
VEHICLE_MOVEMENT_LABELS = {
"vehicle drives on ego lane",
"vehicle drives on non ego lane",
"vehicle drives on opposite lane",
"vehicle brakes in ego lane",
"vehicle brakes in non ego lane",
"vehicle changes lane right into ego lane",
"vehicle changes lane right out of ego lane",
"vehicle changes lane right away from ego lane",
"vehicle changes lane left into ego lane",
"vehicle changes lane left out of ego lane",
"vehicle changes lane left away from ego lane",
"vehicle drives in front ego",
"vehicle drives on bridge",
"vehicle drives through intersection",
"vehicle drives through tunnel",
"vehicle drives under bridge",
"vehicle drives over speed bump",
"vehicle drives left ego",
"vehicle drives right ego",
"vehicle merges into highway entrance",
"vehicle merges out of highway entrance",
"vehicle merges into highway exit",
"vehicle merges out of highway exit",
"vehicle merges into rotary",
"vehicle merges out of rotary",
"vehicle passes left ego",
"vehicle passes left pedestrian",
"vehicle passes right ego",
"vehicle passes right pedestrian",
"vehicle parked in ego lane",
"vehicle parked in non ego lane",
"vehicle parked on sidewalk",
"vehicle parked on shoulder",
"vehicle turns left at intersection",
"vehicle turns right at intersection",
"vehicle turns left at fork",
"vehicle turns right at fork",
"vehicle waits at signals",
"vehicle waits at signs",
"vehicle waits at crosswalk",
"vehicle waits behind vehicle",
"vehicle waits behind bicyclist",
"vehicle signals left at ego",
"vehicle signals right at ego",
"vehicle hazards at ego",
"vehicle parking",
"vehicle merges into road",
}
# ── Movements – Pedestrian ───────────────────────────────────
PEDESTRIAN_MOVEMENT_LABELS = {
"pedestrian stands in ego lane",
"pedestrian stands in non ego lane",
"pedestrian stands on crosswalk",
"pedestrian stands on sidewalk",
"pedestrian walks in ego lane",
"pedestrian walks in non ego lane",
"pedestrian walks on crosswalk",
"pedestrian walks on shoulder",
"pedestrian walks on sidewalk",
}
# ── Movements – Animal ───────────────────────────────────────
ANIMAL_MOVEMENT_LABELS = {
"animal stands in ego lane",
"animal stands in non ego lane",
"animal stands on crosswalk",
"animal stands on sidewalk",
"animal walks in ego lane",
"animal walks in non ego lane",
"animal walks on crosswalk",
"animal walks on shoulder",
"animal walks on sidewalk",
}
# ── Actors ───────────────────────────────────────────────────
ACTOR_VEHICLE_LABELS = {
"ego car", "sedan", "suv", "other car", "van",
"motorcycle", "bicycle", "bicyclist",
"truck", "bus", "police", "firetruck", "ambulance",
}
ACTOR_PROPERTY_LABELS = {"payload", "trailer", "articulated"}
ACTOR_ANIMAL_LABELS = {"dog", "deer"}
ACTOR_PEDESTRIAN_LABELS = {"child", "adult", "wheel chair"}
# ── Static Objects ───────────────────────────────────────────
TRAFFIC_SIGNAL_LABELS = {
"protected turn", "unprotected turn",
"flashing signal", "walk signal",
}
TRAFFIC_SIGN_LABELS = {
"exit sign", "speed sign", "stop sign", "no parking sign",
"bus stop sign", "children crossing sign",
"school zone sign", "walk sign",
}
# ── Full flat valid label set (used by R02) ──────────────────
ALL_VALID_LABELS: set = (
WEATHER_LABELS
| TIME_OF_DAY_LABELS
| VISIBILITY_LABELS
| SETTING_AREA_LABELS
| SETTING_INFRASTRUCTURE_LABELS
| SETTING_NATURE_LABELS
| ROAD_PROPERTY_LABELS
| EVENT_LABELS
| EGO_MOVEMENT_LABELS
| VEHICLE_MOVEMENT_LABELS
| PEDESTRIAN_MOVEMENT_LABELS
| ANIMAL_MOVEMENT_LABELS
| ACTOR_VEHICLE_LABELS
| ACTOR_PROPERTY_LABELS
| ACTOR_ANIMAL_LABELS
| ACTOR_PEDESTRIAN_LABELS
| TRAFFIC_SIGNAL_LABELS
| TRAFFIC_SIGN_LABELS
| {"total lanes"}
)
# SOP constraint: urban/residential must also have buildings
URBAN_RESIDENTIAL = {"urban", "residential"}
# SOP constraint: event tag max duration (seconds)
EVENT_MAX_SECONDS = 5.0