Deep Feature Learning from Multi-Source Remote Sensing Data for Landslide Spatial Pattern Analysis and Cross-Regional Generalization

# MSDFF: Multi-Source Deep Feature Framework for Landslide Detection ## Overview This repository contains a PyTorch implementation framework for the **Multi-Source Deep Feature Framework (MSDFF)**, designed for multi-source and multi-temporal landslide segmentation, latent feature extraction, spatial characterization, and cross-dataset evaluation. MSDFF combines complementary information from Sentinel-2 optical imagery, Sentinel-1 synthetic aperture radar (SAR), digital elevation models (DEM), and slope. Modality-specific spatial encoders extract representations from the different input sources. ConvGRU-based temporal encoding and temporal attention are used to represent changes across satellite observations. A gated fusion module integrates the encoded features, and a segmentation decoder produces pixel-level landslide predictions. The repository also includes utilities for preparing aligned patch archives, training the model, evaluating segmentation predictions, and analyzing learned latent representations. **Important:** The scripts in this repository provide a reproducible code framework and define the expected input format. They should be checked against the exact preprocessing records, model checkpoint, and final experimental implementation before being used to claim exact reproduction of reported manuscript results. The repository does not contain the original satellite datasets or pretrained weights. ## Main Components | File | Main functionality | | --- | --- | | `dataset.py` | Reads preprocessed NPZ patches, validates arrays, creates deterministic data splits, and builds PyTorch DataLoaders. | | `preprocessing.py` | Provides patch validation, band selection, temporal date matching, validity masks, training-set normalization statistics, terrain stacking, and NPZ export. | | `model.py` | Defines the MSDFF network, spatial encoders, ConvGRU temporal encoder, temporal attention, gated fusion, segmentation decoder, and loss functions. | | `train.py` | Trains MSDFF, applies AdamW and cosine learning-rate scheduling, performs validation-based early stopping, and saves checkpoints and run logs. | | `evaluate.py` | Loads a trained checkpoint, calculates segmentation metrics, and saves predictions and latent features. | | `spatial_analysis.py` | Performs PCA, optional UMAP, K-means clustering, and optional spatial autocorrelation and hotspot analysis. | ## Datasets The research workflow considers two public landslide remote-sensing datasets. ### Sen12Landslides Sen12Landslides is used as the primary dataset for model development, temporal representation learning, ablation experiments, and spatial feature analysis. The full-input configuration uses: - Sentinel-2 optical imagery. - Sentinel-1 ascending-orbit SAR observations. - Sentinel-1 descending-orbit SAR observations. - DEM. - Slope. - Landslide reference masks. - Multi-temporal observations. The optical input is configured to use the following ten bands: `B2, B3, B4, B5, B6, B7, B8, B8A, B11, B12`. Each Sentinel-1 orbit stream contains two channels: `VV` and `VH`. The full temporal configuration uses 15 observation positions. ### Landslide4Sense Landslide4Sense is used as an independent dataset for cross-dataset evaluation. The common-input setting uses optical and terrain variables available in both datasets: - Ten selected optical channels. - DEM. - Slope. The common-input configuration is intended to provide compatible model inputs across datasets. The actual product metadata, coordinate reference systems, vertical reference, spatial resolution, and slope derivation must be checked and documented for each source. ### Dataset Access and Licensing Download datasets from their official distribution sources and follow the terms provided by the dataset owners. This repository does not redistribute the original data. Before running the scripts, convert the downloaded data into the NPZ patch format described below. Dataset-specific geospatial conversion must use the original product metadata and the preprocessing decisions documented for the experiment. ## Input Data Format The six Python scripts operate on **preprocessed NumPy archive files (`.npz`)**. Each archive represents one spatial patch. ### Required Arrays | Array | Shape | Description | | --- | --- | --- | | `optical` | `[T, 10, H, W]` | Sentinel-2 time series using the selected ten bands. | | `terrain` | `[2, H, W]` | Terrain channels, ordered as DEM and slope. | | `mask` | `[H, W]` | Binary landslide reference mask; landslide pixels are greater than zero. | For the main experimental patch configuration, `H` and `W` are both 128 and `T` is 15. ### Additional Arrays for Full Multi-Source Mode | Array | Shape | Description | | --- | --- | --- | | `sar_asc` | `[T, 2, H, W]` | Ascending-orbit Sentinel-1 VV and VH observations. | | `sar_desc` | `[T, 2, H, W]` | Descending-orbit Sentinel-1 VV and VH observations. | | `asc_valid` | `[T]` | Validity mask for ascending-orbit observations. | | `desc_valid` | `[T]` | Validity mask for descending-orbit observations. | A validity value of `1` indicates an available observation; `0` indicates a missing observation. ### Optional Arrays | Array | Shape | Description | | --- | --- | --- | | `optical_valid` | `[T]` | Validity mask for optical observations. | | `sample_id` | Scalar string | Identifier for the patch. | | `region_id` | Scalar string | Geographic region identifier. | The loader expects `optical`, `terrain`, and `mask` in both modes. In `full` mode, missing SAR arrays are currently initialized as zeros and their validity masks default to zero. For scientifically valid full-mode experiments, prepare the SAR arrays and validity masks explicitly rather than relying on these defaults. ## Installation ### Requirements The main dependencies are: - Python 3.10 - PyTorch 2.2 - NumPy - scikit-learn The CUDA toolkit, NVIDIA driver, and PyTorch build must be mutually compatible. The manuscript’s reference environment is Ubuntu 22.04, Python 3.10, PyTorch 2.2, and CUDA 12.1. ## Model Architecture The `model.py` file defines the principal network components. ### Spatial Encoders Separate encoders process optical, radar, and terrain inputs. The encoder feature widths are configured as 64, 128, 256, and 512 channels. ### Temporal Encoding A ConvGRU cell models temporal changes while preserving spatial feature maps. A temporal attention layer assigns weights to the available observations. Modality-specific validity masks are used to handle missing time steps. ### Gated Cross-Modal Fusion The gated fusion module projects modality features into a common channel dimension and learns spatially varying weights for their integration. ### Prediction and Latent Features The decoder produces a one-channel segmentation logit map. Global average pooling of the fused feature map produces a latent representation, configured to 256 dimensions, for subsequent analysis. The `MSDFF` class supports two input modes: - `full`: optical, terrain, ascending SAR, and descending SAR. - `common`: optical and terrain only. ## Training The training script uses the NPZ directory described above. ### Reference Configuration | Parameter | Setting | | --- | --- | | Optimizer | AdamW | | Initial learning rate | `1e-4` | | Weight decay | `1e-4` | | Batch size | 8 | | Maximum epochs | 120 | | Learning-rate scheduler | Cosine annealing | | Minimum learning rate | `1e-6` | | Early-stopping patience | 15 epochs | | Gradient clipping | 5.0 | | Mixed precision | Optional | | Segmentation threshold for validation IoU | 0.5 | | Loss | 0.5 BCE + 0.5 Dice | The current training script selects and saves the checkpoint with the highest validation IoU. The validation split is created deterministically from the sample list using the selected random seed. ## Evaluation `evaluate.py` evaluates a checkpoint on the NPZ patches in a specified directory. The script calculates: - Precision. - Recall. - F1 Score. - Intersection over Union (IoU). - Area Under the ROC Curve (AUC). - Confusion-matrix counts. - Positive-pixel prevalence. The threshold for binary prediction defaults to 0.5. ## Reproducibility Notes and Current Scope For reproducible experiments, retain and report: - Dataset version and sample identifiers. - Geographic train/validation/test partition definitions. - Random seeds. - Optical band names and channel order. - SAR orbit selection and temporal matching records. - Missing-observation masks. - DEM source, vertical datum, units, and spatial resolution. - Slope derivation algorithm and settings. - Normalization statistics fitted on training data. - Model configuration and optimizer settings. - Best checkpoint selection criterion. - Probability threshold and evaluation metrics. - Software versions and hardware configuration. The scripts provide core utilities, but several operations depend on dataset-specific metadata and experiment choices. In particular, geospatial reprojection, vertical datum conversion, terrain-product matching, construction of geographic hold-out splits, and conversion of original source files into NPZ patches must be performed and verified as part of the data preparation workflow. The current `dataset.py` split helper performs random sample-level partitioning. It should not be used as a substitute for region-held-out splitting. Likewise, the included code should not be described as having reproduced the manuscript’s numerical results until the complete pipeline has been run on the specified data and the results have been independently checked. ## License Add a `LICENSE` file before making the repository public. The code license should be selected by the authors. The original satellite datasets remain subject to their own licenses and terms of use. ## Acknowledgements The authors acknowledge the providers of Sen12Landslides and Landslide4Sense for making landslide remote-sensing datasets available to the research community.
from __future__ import annotations

import argparse
import json
import random
import time
from pathlib import Path
from typing import Dict

import numpy as np
import torch
from torch import nn
from torch.cuda.amp import GradScaler, autocast

from dataset import LandslidePatchDataset, make_loaders
from model import MSDFF, bce_dice_loss


SEEDS = [13, 29, 47, 71, 101, 131, 173, 211, 257, 307]


def set_seed(seed: int) -> None:
    """Set Python, NumPy, and PyTorch random seed

Termux shorctus Android

# Termux shorcuts Google Pixel Desktop Mode

* Create a new session: ˋCtrl + Alt + c ˋ  
* Move to a certain session: ˋCtrl + Alt+ [session-number(1,2,3,4)] ˋ 
* Move to next session: ˋ Ctrl + Alt + nˋ
* Move to the previous sesion: ˋCtrl + Alt + pˋ 
* Rename session: ˋCtrl + Alt + rˋ
* Open settings: ˋCtrl + Alt + mˋ 
* See all tabs: ˋ Win-key + leftˋ 
* Close a session: Type ˋexitˋ 

3364. Minimum Positive Sum Subarray

You are given an integer array nums and two integers l and r. Your task is to find the minimum sum of a subarray whose size is between l and r (inclusive) and whose sum is greater than 0. Return the minimum sum of such a subarray. If no such subarray exists, return -1. A subarray is a contiguous non-empty sequence of elements within an array.
/**
 * @param {number[]} nums
 * @param {number} l
 * @param {number} r
 * @return {number}
 */
var minimumSumSubarray = function(nums, l, r) {
    const prefix = Array(nums.length + 1).fill(0);

    // prefix[i] is the sum of nums[0..i-1].
    for (let i = 0; i < nums.length; i++) {
        prefix[i + 1] = prefix[i] + nums[i];
    }

    let answer = Infinity;

    // Try each permitted subarray length.
    for (let length = l; length <= r; length++) {
        for (let start = 0; start + length

small_pdf

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.5 -dNOPAUSE -dQUIET -dBATCH \
  -sOutputFile=output.pdf \
  -dDownsampleColorImages=true -dColorImageResolution=120 -dColorImageDownsampleThreshold=1.0 \
  -dDownsampleGrayImages=true -dGrayImageResolution=120 -dGrayImageDownsampleThreshold=1.0 \
  -dDownsampleMonoImages=true -dMonoImageResolution=200 \
  -dAutoFilterColorImages=false -dColorImageFilter=/DCTEncode \
  -dAutoFilterGrayImages=false -dGrayImageFilter=/DCTEncode \
  LU01_Vorgehensmodelle_a

3420. Count Non-Decreasing Subarrays After K Operations

You are given an array nums of n integers and an integer k. For each subarray of nums, you can apply up to k operations on it. In each operation, you increment any element of the subarray by 1. Note that each subarray is considered independently, meaning changes made to one subarray do not persist to another. Return the number of subarrays that you can make non-decreasing ​​​​​after performing at most k operations. An array is said to be non-decreasing if each element is greater than or equal to its previous element, if it exists.
/**
 * @param {number[]} nums
 * @param {number} k
 * @return {number}
 */
var countNonDecreasingSubarrays = function(nums, k) {
    const n = nums.length;
    const deque = []; // Indices of the active prefix-maximum segments
    let head = 0;     // Front of the deque
    let right = n - 1;
    let cost = 0;
    let answer = 0;

    // Fix each left endpoint, moving from right to left.
    for (let left = n - 1; left >= 0; left--) {
        const x = nums[left];

        // A new, larger value

Camunda-Links

# Camunda Links

## Understanding Camunda

* [Getting started](https://docs.camunda.io/docs/components/concepts/concepts-overview/)
* [Using Camunda](https://docs.camunda.io/docs/components/)
* [Best practices](https://docs.camunda.io/docs/components/best-practices/best-practices-overview/)
* [Recommended stack](https://docs.camunda.io/docs/components/best-practices/architecture/deciding-about-your-stack/)

## Spring Boot Hands-on applications 

* [Developer Quickstart](https://docs.camunda.io/d

SPA (modern port knocking)

## Install client

General_Writing_Practice_set_2_test_6

Task 1
Dear Sir/Madam,

I am writing to enquire about your evening courses for learning German language. I have learned German at secondary school for three years and now I need to improve my language skills so I could speak fluently with our German customers at work. My questions are:

- What types of courses do you offer and at which levels?
- How long does one course last?
- Do you offer an exam at the end of the course?
- Since my employer would pay for the course, I must attend a course tau

Rafael Florist - San Rafael CA Florist | Flower Delivery

Rafael Florist in San Rafael, CA - premier local florist providing flower delivery in Marin County. Custom arrangements, wedding flowers, sympathy flowers and same-day flower delivery. Website: https://rafaelflorist.com/ - 815 3rd St, San Rafael, CA 94901 - (415) 457-4711
# Rafael Florist

Rafael Florist, the epitome of floral artistry in San Rafael, CA, is your premier local florist providing the Marin County area with exquisite flower delivery services.

Website: https://rafaelflorist.com/

Address: 815 3rd St, San Rafael, CA 94901, USA
Phone: (415) 457-4711
Email: info@rafaelflorist.com

Services: flower designer, send flowers, flower delivery, wedding florist, sympathy and funeral flowers, custom bouquet arrangements, luxury floral, get well flowers, same day

TigerWood Construction — High-End Home Remodeling & Outdoor Living in the San Francisco Bay Area

TigerWood Construction is a licensed & insured general contractor based in San Bruno, CA (License #1157797). Address: 581 4th Ave, San Bruno, CA 94066 Phone: +1 650-333-6071 Email: info@tigerwoodconstruction.com Website: https://www.tigerwoodconstruction.com Instagram: https://www.instagram.com/tigerwoodcompany/ (@tigerwoodcompany) Services: kitchen remodeling, bathroom remodeling, garage remodeling & ADUs, design, decks, outdoor kitchens, retaining walls, pavers & artificial grass, fences, pergolas, fire pits, storage & studio sheds. Hours: Mon-Fri 8am-5pm Visit our website: [TigerWood Construction](https://www.tigerwoodconstruction.com) Follow us on Instagram: [Instagram @tigerwoodcompany](https://www.instagram.com/tigerwoodcompany/)
# TigerWood Construction — High-End Home Remodeling & Outdoor Living in the San Francisco Bay Area

TigerWood Construction is a licensed & insured general contractor based in San Bruno, CA (License #1157797).

Address: 581 4th Ave, San Bruno, CA 94066
Phone: +1 650-333-6071
Email: info@tigerwoodconstruction.com
Website: https://www.tigerwoodconstruction.com
Instagram: https://www.instagram.com/tigerwoodcompany/ (@tigerwoodcompany)

Services: kitchen remodeling, bathroom remodeling, garage remode

3789. Minimum Cost to Acquire Required Items

You are given five integers cost1, cost2, costBoth, need1, and need2. There are three types of items available: An item of type 1 costs cost1 and contributes 1 unit to the type 1 requirement only. An item of type 2 costs cost2 and contributes 1 unit to the type 2 requirement only. An item of type 3 costs costBoth and contributes 1 unit to both type 1 and type 2 requirements. You must collect enough items so that the total contribution toward type 1 is at least need1 and the total contribution toward type 2 is at least need2. Return an integer representing the minimum possible total cost to achieve these requirements.
/**
 * @param {number} cost1
 * @param {number} cost2
 * @param {number} costBoth
 * @param {number} need1
 * @param {number} need2
 * @return {number}
 */
var minimumCost = function(cost1, cost2, costBoth, need1, need2) {
    const smallerNeed = Math.min(need1, need2);
    const largerNeed = Math.max(need1, need2);

    // Buy only type 1 and type 2 items.
    const separateCost = need1 * cost1 + need2 * cost2;

    // Use type 3 items for the shared portion, then buy the remaining needs separa

General_Listening_Practice_set_2_Test_6

Colin
15
731
premium
462
A
C
D
F
H
C
G
B
D
F
10
garage
on the beach
town center
by taxi
Europe
work permit
grammar
cafes
quality
Arabic
vocabulary
approved programm
contacts
translation
*SEE PFD*

GCDS Helper iframe

/*
 * GCDS iframe add-on for Adobe Tags
 * For each same-origin iframe (including srcdoc previews), listens for gcdsClick inside
 * the frame and re-fires it on the <iframe> element in this page, so the existing
 * gcdsClick rule and data elements fire. Adds `frame` (the iframe's src or title).
 */
(function () {
  if (!window.gcdsClickInfo || window.__gcdsFramesHooked) return;
  window.__gcdsFramesHooked = true;

  function hook(frame) {
    var win;
    try { win = frame.contentWin

GCDS helper code

  /*
 * window.gcdsClickInfo(event) takes the Adobe Tags `event` and returns:
 *   href       the link URL (same as event.detail)
 *   text       the label that was clicked: footer link, card title, language
 *              toggle ("Français" / "English"), details title, any gcds-link
 *   component  the GCDS component that rendered it: gcds-footer, gcds-card,
 *              gcds-lang-toggle, gcds-details, gcds-header, gcds-link ...
 *   state      gcds-details only: "expand" or "collaps

3693. Climbing Stairs II

You are climbing a staircase with n + 1 steps, numbered from 0 to n. You are also given a 1-indexed integer array costs of length n, where costs[i] is the cost of step i. From step i, you can jump only to step i + 1, i + 2, or i + 3. The cost of jumping from step i to step j is defined as: costs[j] + (j - i)2 You start from step 0 with cost = 0. Return the minimum total cost to reach step n.
/**
 * @param {number} n
 * @param {number[]} costs
 * @return {number}
 */
var climbStairs = function(n, costs) {
    // dp[i] is the minimum cost to reach step i.
    const dp = Array(n + 1).fill(Infinity);
    dp[0] = 0;

    for (let i = 1; i <= n; i++) {
        // Try each allowed jump length;
        for (let jump = 1; jump <= 3; jump++) {
            const prev = i - jump;

            if (prev >= 0) {
                // costs is 1-indexed, so step i uses costs[i - 1].
                co

internet speed mac

networkQuality