Initial commit: caption quality test on UAV-VisLoc
Self-contained experimental track validating generated text captions
via retrieval R@1 lift on UAV-VisLoc.
Architecture: GeoRSCLIP ViT-B/32 dual encoder, 512-dim shared space.
Loss: 4-term InfoNCE (img-img + sat-cap + drone-cap + cap-cap)
with cosine temperature decay, PALW-like curriculum.
Metric: delta R@1 (with text - without text) >= +3% => PASS.
Gin-configured (balanced / baseline_no_text / text_heavy variants).
Follows NADEZHDA code style.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
54
conf/balanced.gin
Normal file
54
conf/balanced.gin
Normal file
@@ -0,0 +1,54 @@
|
||||
# Balanced configuration — primary test setup.
|
||||
# L = 1.0 * L_img_img + 0.3 * L_sat_cap + 0.3 * L_drone_cap + 0.1 * L_cap_cap
|
||||
|
||||
import src.datasets.visloc_with_captions
|
||||
import src.losses.multi_infonce
|
||||
import src.models.dual_encoder
|
||||
import src.training.train
|
||||
|
||||
# ---- Dual encoder ----
|
||||
DualEncoderCaptionTest.variant = "ViT-B-32"
|
||||
DualEncoderCaptionTest.pretrained_path = "checkpoints/RS5M_ViT-B-32.pt"
|
||||
DualEncoderCaptionTest.unfreeze_mode = "last_block"
|
||||
DualEncoderCaptionTest.embed_dim = 512
|
||||
DualEncoderCaptionTest.use_mlp_heads = False
|
||||
DualEncoderCaptionTest.shared_image_head = True
|
||||
DualEncoderCaptionTest.device = "cuda"
|
||||
|
||||
ProjectionHead.in_dim = 512
|
||||
ProjectionHead.out_dim = 512
|
||||
ProjectionHead.use_mlp = False
|
||||
|
||||
# ---- Loss ----
|
||||
MultiTermInfoNCE.temperature_init = 0.1
|
||||
MultiTermInfoNCE.temperature_final = 0.01
|
||||
MultiTermInfoNCE.label_smoothing = 0.1
|
||||
MultiTermInfoNCE.asym_drone_to_sat = 0.6
|
||||
MultiTermInfoNCE.asym_sat_to_drone = 0.4
|
||||
MultiTermInfoNCE.warmup_epochs = 3
|
||||
MultiTermInfoNCE.text_ramp_epochs = 10
|
||||
MultiTermInfoNCE.lambda_ii = 1.0
|
||||
MultiTermInfoNCE.lambda_sc_max = 0.3
|
||||
MultiTermInfoNCE.lambda_dc_max = 0.3
|
||||
MultiTermInfoNCE.lambda_cc_max = 0.1
|
||||
|
||||
# ---- Dataset ----
|
||||
VisLocCaptionDataset.caption_strategy = "hybrid"
|
||||
VisLocCaptionDataset.drop_caption_prob = 0.0
|
||||
VisLocCaptionDataset.seed = 42
|
||||
|
||||
# ---- Training ----
|
||||
TrainConfig.train_manifest = "data/visloc_train.json"
|
||||
TrainConfig.val_manifest = "data/visloc_val.json"
|
||||
TrainConfig.image_root = "data/visloc/images"
|
||||
TrainConfig.output_dir = "out/caption_test/balanced"
|
||||
TrainConfig.epochs = 30
|
||||
TrainConfig.batch_size = 128
|
||||
TrainConfig.num_workers = 4
|
||||
TrainConfig.learning_rate = 1e-4
|
||||
TrainConfig.weight_decay = 1e-4
|
||||
TrainConfig.grad_clip = 1.0
|
||||
TrainConfig.use_amp = True
|
||||
TrainConfig.eval_every = 1
|
||||
TrainConfig.seed = 42
|
||||
TrainConfig.device = "cuda"
|
||||
11
conf/baseline_no_text.gin
Normal file
11
conf/baseline_no_text.gin
Normal file
@@ -0,0 +1,11 @@
|
||||
# Baseline: image-image only, no captions. Reference R@1 for delta computation.
|
||||
# L = 1.0 * L_img_img
|
||||
|
||||
include 'balanced.gin'
|
||||
|
||||
# Disable all caption loss terms.
|
||||
MultiTermInfoNCE.lambda_sc_max = 0.0
|
||||
MultiTermInfoNCE.lambda_dc_max = 0.0
|
||||
MultiTermInfoNCE.lambda_cc_max = 0.0
|
||||
|
||||
TrainConfig.output_dir = "out/caption_test/baseline_no_text"
|
||||
11
conf/text_heavy.gin
Normal file
11
conf/text_heavy.gin
Normal file
@@ -0,0 +1,11 @@
|
||||
# Text-heavy configuration — stress test of caption contribution.
|
||||
# L = 0.5 * L_img_img + 0.5 * L_sat_cap + 0.5 * L_drone_cap + 0.2 * L_cap_cap
|
||||
|
||||
include 'balanced.gin'
|
||||
|
||||
MultiTermInfoNCE.lambda_ii = 0.5
|
||||
MultiTermInfoNCE.lambda_sc_max = 0.5
|
||||
MultiTermInfoNCE.lambda_dc_max = 0.5
|
||||
MultiTermInfoNCE.lambda_cc_max = 0.2
|
||||
|
||||
TrainConfig.output_dir = "out/caption_test/text_heavy"
|
||||
Reference in New Issue
Block a user