Unify segmentation classes (17) across GTA-UAV and UAV_VisLoc

Extract shared UNIFIED_PROMPTS (17 classes, ID 0-16) into
scripts/seg_classes.py for transfer learning compatibility.
Both run_gta_uav.py and run_uav_visloc.py now import from it.

Key change: swimming pool moved from ID 13 → ID 16, so sports field
(ID 13), muddy ground (14), embankment (15) have stable IDs across
both datasets. Missing classes in a dataset = 0 pixels = 0 loss.

Updated: README, CLAUDE.md, segmentation_class_analysis.md, palette.
Deleted old UAV_VisLoc segmentations (need regeneration with 17 classes).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
pikaliov
2026-04-17 22:06:10 +03:00
parent 143a837c03
commit 3b5778e303
7 changed files with 88 additions and 107 deletions

View File

@@ -32,6 +32,7 @@ from src.conf.pipeline_conf import PipelineConfig
from src.conf.seg_conf import SegConfig
from src.augmentor.io_utils import setup_logging
from src.main import run_pipeline
from scripts.seg_classes import UNIFIED_PROMPTS
INPUT_ROOT = "/home/servml/Документы/datasets/GTA-UAV-LR"
@@ -82,22 +83,7 @@ def main() -> None:
# GTA V synthetic scenes: urban, suburban, rural, coastal, mountainous
# 11 base classes + pool (swimming pools common in GTA suburbs)
seg_conf = SegConfig(threshold=0.15, prompts=[
"background", # 0
"building", # 1
"road", # 2
"vegetation", # 3
"water", # 4
"sand and gravel ground", # 5
"rocky terrain", # 6
"farmland", # 7
"railway", # 8
"parking lot", # 9
"sidewalk", # 10
"bare soil and plowed field", # 11
"roof and rooftop", # 12
"swimming pool", # 13
])
seg_conf = SegConfig(threshold=0.15, prompts=UNIFIED_PROMPTS)
models_conf = ModelsConfig(weights_dir=str(_PROJECT_ROOT / "in" / "weights"))

View File

@@ -27,6 +27,7 @@ from src.conf.pipeline_conf import PipelineConfig
from src.conf.seg_conf import SegConfig
from src.augmentor.io_utils import setup_logging
from src.main import run_pipeline
from scripts.seg_classes import UNIFIED_PROMPTS
INPUT_ROOT = "/home/servml/Документы/datasets/UAV_VisLoc_processed"
@@ -73,24 +74,7 @@ def main() -> None:
)
input_conf = InputConfig(image_size=256)
seg_conf = SegConfig(threshold=0.1, prompts=[
"background", # 0
"building", # 1
"road", # 2
"vegetation", # 3
"water", # 4
"sand and gravel ground", # 5
"rocky terrain", # 6
"farmland", # 7
"railway", # 8
"parking lot", # 9
"sidewalk", # 10
"bare soil and plowed field", # 11
"roof and rooftop", # 12
"sports field and playground", # 13
"muddy ground and wetland", # 14
"embankment and levee", # 15
])
seg_conf = SegConfig(threshold=0.1, prompts=UNIFIED_PROMPTS)
models_conf = ModelsConfig(weights_dir=str(_PROJECT_ROOT / "in" / "weights"))
setup_logging(

30
scripts/seg_classes.py Normal file
View File

@@ -0,0 +1,30 @@
"""Unified segmentation classes shared across all datasets.
All datasets MUST use the same prompt list and class IDs to enable
transfer learning (e.g., pretrain on GTA-UAV → fine-tune on UAV_VisLoc).
Not every dataset will have pixels for every class — that's fine.
A class with 0 pixels simply won't contribute to training loss.
"""
UNIFIED_PROMPTS: list[str] = [
"background", # 0
"building", # 1
"road", # 2
"vegetation", # 3
"water", # 4
"sand and gravel ground", # 5
"rocky terrain", # 6
"farmland", # 7
"railway", # 8
"parking lot", # 9
"sidewalk", # 10
"bare soil and plowed field", # 11
"roof and rooftop", # 12
"sports field and playground", # 13
"muddy ground and wetland", # 14
"embankment and levee", # 15
"swimming pool", # 16
]
NUM_CLASSES = len(UNIFIED_PROMPTS) # 17