20 Commits

Author SHA1 Message Date
pikaliov
75502b481e Docs: clarify dense tensor maps format and training usage
All modalities are stored as dense spatial tensor maps (not RGB renders):
- depth/edge/chm: [1,H,W] float16 continuous values
- segm: [1,H,W] uint8 dense class ID map (0-16)

Add training code examples: one-hot encoding, per-class embedding,
aux-encoder injection. Document why tensors over RGB renders (70% info
loss + OOD for DINOv3).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 04:10:57 +03:00
pikaliov
43c81ae8a4 Fix edges stage: group by resolution before stacking
Mixed-size datasets (e.g. GTA-UAV: drone 512x512 + satellite 256x256)
caused torch.stack error in run_edges_stage. Now groups depth tensors
by spatial resolution and processes each group separately.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 03:59:36 +03:00
pikaliov
3143dc7bf2 Update docs with post-processing results: bg 57% → 5%
Verified on 128 satellite images after dark water fix (std threshold
0.08 → 0.18). Document calibrated thresholds and measured improvements.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 02:53:19 +03:00
pikaliov
891efdf738 Fix dark water threshold: std 0.08 → 0.18
GTA-UAV dark ocean images have std ~0.10-0.15 (blue gradient), not
<0.08 as assumed. Raised dark_water_std_thr to 0.18 to cover all
dark water images while staying safe for non-water backgrounds.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 02:48:59 +03:00
pikaliov
ff002ce142 Update README and CLAUDE.md: unified 17 classes, post-processing, 3 datasets
- All datasets now use unified 17 classes (not 11/14/16 separately)
- Document seg post-processing (dark water fix, wetland reclassify)
- Update test count (149), time estimates (17 prompts), palette
- Add seg_classes.py to project structure
- Fix outdated references throughout

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 02:46:59 +03:00
pikaliov
f0c876dfc7 Add segmentation post-processing: dark water fix + wetland reclassify
Two heuristic rules applied after SegEarth-OV3 inference:

1. Dark water: if background pixels have mean_rgb < 0.24 and std < 0.08,
   reclassify as water. Fixes GTA-UAV satellite dark ocean (57% → ~15% bg).

2. Wetland reclassify (GTA-UAV only): split false-positive wetland pixels
   by color — green-dominant → vegetation, else → bare soil. Fixes 14.3%
   muddy/wetland false positives on GTA-V hillside terrain.

Config flags: seg_fix_dark_water (default True), seg_reclassify_wetland
(default False, enabled in run_gta_uav.py).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-18 02:37:43 +03:00
pikaliov
d1ddb40036 Update segmentation.gin to unified 17 classes
All datasets now use the same 17-class prompt list for transfer
learning compatibility. World-UAV segmentation needs regeneration.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 22:08:56 +03:00
pikaliov
3b5778e303 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>
2026-04-17 22:06:10 +03:00
pikaliov
143a837c03 Add GTA-UAV-LR annotation script + dataset documentation
- Add scripts/run_gta_uav.py for GTA-UAV-LR (48K images, GTA V synthetic)
- 14 segmentation classes: 11 base + bare soil, rooftop, swimming pool
- Fix source filter to recognize "satellite" folder (alongside "DB")
- Document GTA-UAV characteristics in segmentation_class_analysis.md
- Update README and CLAUDE.md with GTA-UAV support

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 21:55:56 +03:00
pikaliov
27eb315903 Update docs: CLAUDE.md, README, segmentation class analysis
- Create CLAUDE.md with project overview, key decisions, structure
- Update README: add UAV_VisLoc dataset, 16-class palette, scripts
- Extend segmentation_class_analysis.md with UAV_VisLoc section:
  quantitative analysis of 2496 images, 5 new classes with detailed
  justification (bare soil, rooftop, sports field, wetland, embankment),
  threshold rationale, and irreducible background explanation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 21:27:25 +03:00
pikaliov
5c4a3a1371 Lower segmentation threshold to 0.1 for UAV_VisLoc
Default 0.3 was too aggressive — dark water, muddy ground, and
uniform textures fell below confidence threshold. Lower to 0.1
to reduce false background pixels.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 21:12:43 +03:00
pikaliov
5ff4effddb Add muddy ground and embankment classes for UAV_VisLoc
Background analysis on crop_0_0/0_1 showed wetland/embankment areas
(dark grey-green, avg RGB 101,103,97) between water bodies not covered
by any existing class. Add:
- "muddy ground and wetland" (ID 14)
- "embankment and levee" (ID 15)

Total: 14 → 16 classes for UAV_VisLoc.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 21:08:45 +03:00
pikaliov
30252a53f8 Add 3 segmentation classes for UAV_VisLoc: bare soil, rooftop, sports field
Analysis of scene 01 showed 29% background pixels, mainly caused by:
- Plowed/bare fields (no crop match) → add "bare soil and plowed field"
- Dark/textured roofs missed by "building" → add "roof and rooftop"
- Sports fields/playgrounds → add "sports field and playground"

Total: 11 → 14 classes. Palette extended with 3 new colors.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 21:00:02 +03:00
pikaliov
c091bd89c0 Fix: use absolute weights_dir in UAV_VisLoc script
Relative 'in/weights' path fails when script is run from outside the
project root. Use _PROJECT_ROOT / "in" / "weights" instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 20:42:25 +03:00
pikaliov
3d5e9c880f Fix: pass explicit prompts to SegConfig in UAV_VisLoc script
SegConfig(prompts=None) crashes on len(None) when gin config is not
loaded. Pass the 11-class prompt list directly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 17:21:01 +03:00
pikaliov
6f04856b6b Add UAV_VisLoc annotation script + support drone folder naming
- Add scripts/run_uav_visloc.py for UAV_VisLoc_processed dataset (81K images)
- Add gin config for UAV_VisLoc (pipeline_uav_visloc.gin)
- Fix source filter and is_query_record to recognize "drone" folder
  (UAV_VisLoc uses "drone" instead of "query")

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 17:18:38 +03:00
pikaliov
13ff079891 Refactor output to directory-based layout + migration script
Replace prefix-based naming (crop_12_4_depth.png) with directory-based
layout where modality is determined by folder (depth/crop_12_4.png).

New structure:
  output_root/{modality}/{rel_parent}/{stem}.png    (vis)
  output_root/npy/{modality}/{rel_parent}/{stem}.npy (intermediate)
  output_root/safetensors/{rel_parent}/{stem}.safetensors (training)

- Rewrite io_utils.py save functions: (output_root, rel_parent, stem)
- Update ImageRecord: output_root + rel_parent instead of output_dir
- Add path helpers: npy_path(), vis_path(), safetensors_path()
- Add scripts/migrate_layout.py for converting existing datasets
- Update all tests (143 passing)
- Update README with new layout docs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 17:11:01 +03:00
pikaliov
892a2574f6 Fix: ensure safetensors works with PNG-only datasets
- Force save_npy=True when save_safetensors=True (lossless intermediate)
- Auto-enable cleanup_npy to remove intermediates after consolidation
- Save segmentation PNG in palette mode "P" (class IDs recoverable)
- Consolidation now works correctly from PNG-only previous runs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 16:58:04 +03:00
pikaliov
f3cb18ac4d Add SafeTensors consolidation stage for zero-copy tensor loading
Bundle all per-image modalities (depth, edge, chm, segm) into a single
.safetensors file for fast training DataLoader reads (~0.1ms zero-copy mmap
vs ~5ms for 4x PNG). Adds consolidate stage after main pipeline stages,
save_safetensors/cleanup_npy config flags, resume support, and 10 new tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-17 16:53:29 +03:00
pikaliov
686db62c25 Initial commit: World-UAV annotation pipeline
4-modality annotation pipeline (depth, edges, segmentation, chmv2) for 973K
drone/satellite images. SegEarth-OV3 open-vocabulary segmentation with 11
classes optimized for cross-view geo-localization.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-16 11:22:01 +03:00