# Copy to .env and uncomment values as needed (optional for local dev). # python run.py sets APP_MODE=dda automatically. # APP_MODE=dda # REQUIRED for stable login sessions (including in production): without this, # a random secret is generated per process start, invalidating every existing # session/cookie on each restart. Generate one with: # python -c "import secrets; print(secrets.token_hex(32))" # SECRET_KEY=change-me-to-a-long-random-string # Database (default: SQLite in data/satellite_app.db) # DATABASE_URL=sqlite:///./data/satellite_app.db # # MySQL (production for this project): install the driver first # (pip install pymysql, already in requirements.txt), then set: # DATABASE_URL=mysql+pymysql://user:password@host:3306/dbname # URL-encode special characters in the password (e.g. @ -> %40). # # PostgreSQL also supported: # DATABASE_URL=postgresql://user:pass@host/db # Local image library folder (default: library_sources/) # LOCAL_LIBRARY_ROOT=C:/path/to/your/images # Image upload limit in MB (default 15360 = 15 GB) # MAX_GEOTIFF_MB=15360 # MAX_IMAGE_MB=15360 # Automatic mode: identified same-area pairs can be queued on a cadence. # The queue does NOT start when the app launches. On the Automatic tab, set # interval (days) and run-at time (IST), then click Start. Manual mode is # still click-to-run only. The local server must stay running while the # schedule is armed. Set AUTO_DETECT_ENABLED=0 to hide/disable the feature. # AUTO_DETECT_ENABLED=1 # AUTO_DETECT_INTERVAL_DAYS=10 # AUTO_DETECT_RUN_AT=02:00 # Max pixel dimension for detection (lower = less RAM, default 4096 local) # DETECTION_MAX_SIDE=4096 # --- Accuracy controls (all optional; defaults preserve current behavior) --- # Inference mode: downscaled | fullres_tiled | auto # auto = fullres_tiled when before/after paths are GeoTIFF (RCA Critical #1) # DETECTION_INFERENCE_MODE=auto # Full-res cap (px) in fullres_tiled mode; 0 = native resolution # DETECTION_FULLRES_MAX_SIDE=8192 # Native side (px) above which GeoTIFFs stream from disk windows (avoids OOM) # Default lowered 8192→4096 (RCA Significant #5) # DETECTION_WINDOWED_THRESHOLD=4096 # Soft RAM budget (MB) per in-memory array before switching to windowed streaming # DETECTION_TILE_MEMORY_MB=1536 # Tile size / overlap for full-res scoring (overlap default 0.35 — RCA #6 seams) # DETECTION_TILE_SIZE=512 # DETECTION_TILE_OVERLAP=0.35 # Skip SIFT registration on GPS-aligned GeoTIFF pairs: true|false|auto (RCA #4) # DETECTION_SKIP_REGISTRATION_GEOTIFF=auto # Local Delhi fine-tuned AdaptFormer (v3 frozen = Test F1 0.581 @ thr 0.2). # Relative paths are resolved against the repo root (not the process CWD). # ADAPTFORMER_WEIGHTS=models/adaptformer_delhi/v3_frozen # Val-calibrated DL threshold (alias: DETECTION_DL_THRESHOLD). v3 = 0.2 # ADAPTFORMER_THRESHOLD=0.2 # DETECTION_DL_THRESHOLD=0.2 # Multi-scale DL fusion: off or a comma list, e.g. 0.5,1.0,1.5 # DETECTION_MULTISCALE=off # Fusion strategy: smart_union | hysteresis | dl_only # v3 ablation (runs/v3_app_ablation): dl_only @ 0.2 ≈ Test F1 0.58; # smart_union/hysteresis collapsed F1 to ~0.04 — prefer dl_only with v3. # DETECTION_FUSION=dl_only # TTA: off | hflip | full | auto. Ablation: hflip ≈ same F1, ~2x slower on CPU. # DETECTION_TTA=off # Preprocessing toggles # DETECTION_CLAHE=true # DETECTION_HIST_MATCH=false # DETECTION_SKIP_PREBLUR= # auto: on in fullres_tiled mode # Border pixels zeroed in mask cleanup (auto: 4 fullres / 12 downscaled) # DETECTION_BORDER_MARGIN= # Tiles per GPU forward pass (1 = no batching) # DETECTION_TILE_BATCH=1 # Save a downsampled probability-map PNG per run for debugging # DETECTION_SAVE_PROB_MAP=false # Skip the deep model entirely on tiles that are fully unchanged between before/ # after (worst-cell LAB distance below this value — biggest single cell diff, # not an average, so a small real change is never diluted away and missed). # Big speed win on large images where most of the scene is static background; # 0/unset = disabled (default). Start conservative (e.g. 3-5). # DETECTION_SKIP_UNCHANGED_THRESHOLD=0 # --- smart_union fusion calibration (Delhi accuracy sprint, Day 4-6) --- # Base classical-score percentile floor for smart_union fusion. Tuned from # 0.92 -> 0.90 against real Delhi Sentinel-2 imagery: +53% mean F1 on the # 16-pair labeled eval set, verified to pass the full synthetic regression # suite (incl. the mandatory car-FP gate) unchanged. Lower values (0.75-0.85) # scored even higher on Delhi but were REJECTED — they cause false positives # on the parked_cars synthetic case. See runs/calibration/best_params.json # for the full decision record (winning + rejected configs, with reasons). # DETECTION_CL_Q_BASE=0.90 # Base DL confidence floor for smart_union fusion (default 0.36). Tested # down to 0.10 against Delhi imagery — no meaningful effect at full-set scale # (the pretrained AdaptFormer model's near-zero output on this coarse-GSD, # out-of-domain imagery isn't a thresholding problem; needs fine-tuning, not # calibration). Left at default. See runs/calibration/best_params.json. # DETECTION_DL_FLOOR_BASE=0.15 # --- Research-integration channels (KPCAMNet / IR-MAD / SRCDNet / BIT_CD) --- # KPCA deep features (KPCAMNet): auto (default; drives Feature-Based method), # on (also adds a channel to the classical score map), off # DETECTION_KPCA=auto # Analysis-resolution cap for KPCA feature extraction (CPU bound) # DETECTION_KPCA_MAX_SIDE=768 # IR-MAD change statistic: auto (default) | on (adds classical channel) | off # DETECTION_IRMAD=auto # Regression radiometric normalization from IR-MAD no-change pixels # (off by default: reduced F1 on the LEVIR-CD gate; useful for strong # sensor/illumination mismatch between acquisitions) # DETECTION_IRMAD_NORM=false # Resample GeoTIFF pairs to a common (coarser) GSD before detection # DETECTION_GSD_HARMONIZE=true # Relative GSD difference that triggers harmonization/preflight warning # DETECTION_GSD_TOLERANCE=0.15 # Preflight overlap gate: below this fraction of the after-image footprint, # a pair is rejected as not suitable for change detection (hard fail) # DETECTION_MIN_OVERLAP_HARD=0.02 # Below this fraction, overlap is weak but detection still runs (soft warning) # DETECTION_MIN_OVERLAP_WARN=0.20 # Ensemble AdaptFormer with BIT_CD (requires weights, see below; default off) # DETECTION_ENSEMBLE=off # BIT_CD LEVIR-CD checkpoint path. Download best_ckpt.pt from the BIT_CD # repo's release links (https://github.com/justchenhao/BIT_CD) and place it at # app/cd_models/weights/bit_cd_levir.pth (raw training checkpoints with a # model_G_state_dict key are accepted as-is). # BIT_CD_WEIGHTS=app/cd_models/weights/bit_cd_levir.pth # Public URL for report links in emails (default http://localhost:8000 locally) # PUBLIC_BASE_URL=http://localhost:8000 # Email notifications (optional). Password reset still uses this backend. # EMAIL_API_URL=https://emailservice.managemybusinessess.com/api/email/send # Login SMS OTP: POST ToMobile/Message to SMS_API_URL (default: same host as # EMAIL_API_URL with /api/sms/send). Or set SMS_PROVIDER=fast2sms + SMS_API_KEY. # SMS_API_URL= # SMS_PROVIDER= # SMS_API_KEY= # LOGIN_OTP_LOG=1 # SMTP_HOST=smtp.gmail.com # SMTP_PORT=587 # SMTP_USER= # SMTP_PASS= # Hugging Face model cache directory # HF_HOME=./.hf_cache # Department export API (optional — FR-08) # DEPT_API_URL=https://dept.example.gov/api/changes # DEPT_API_KEY=your-api-key # DDA admin account (optional — UAT / ops) # DDA_ADMIN_EMAIL=admin@example.com # DDA_ADMIN_PASSWORD=change-me # DDA_TRAINING_EXPORT_KEY=secret-key-for-fp-export