编程

geoskill-sar-ship-detection

试用

SAR 船舶检测:CA/OS-CFAR 恒虚警检测 + 连通域聚类,从单极化 SAR 强度影像提取船舶目标并输出 GeoJSON 矢量与属性表

它能做什么

SAR 船舶检测:CA/OS-CFAR 恒虚警检测 + 连通域聚类,从单极化 SAR 强度影像提取船舶目标并输出 GeoJSON 矢量与属性表

技能文档

SAR船舶检测 | SAR Ship Detection

Automatically detects ship targets at sea from single-polarization SAR intensity imagery. Core workflow:

  1. CFAR constant false alarm rate detection: within a sliding window, background cells outside the guard band estimate the local clutter power to set an adaptive threshold, maintaining a constant false alarm rate under different sea states.
    • CA-CFAR (cell averaging): threshold = α·μ_bg, α = N·(Pfa^(−1/N) − 1) (closed-form solution for exponential clutter).
    • OS-CFAR (ordered statistics): uses the k-th order statistic of the background to estimate clutter; more robust to multiple targets / clutter edges.
  2. Connected-component clustering: labels connected components of threshold-exceeding pixels and extracts each target's area, centroid, peak intensity and bounding box, converting them to geographic coordinates and outputting GeoJSON.

Application Scenarios / 应用场景

  • Maritime vessel surveillance and illegal fishing monitoring
  • Traffic-flow statistics for ports and shipping lanes
  • Target screening for maritime search and rescue

Dependencies / 依赖

pip install 'numpy' 'rasterio' 'geopandas' 'shapely' 'scipy'

Usage / 使用方法

Example 1 (synthetic data, offline)

python geoskill-sar-ship-detection.py --bbox 121.0 30.0 122.0 31.0 --synthetic --cfar ca --pfa 1e-4 --output-dir ./out

Example 2 (OS-CFAR)

python geoskill-sar-ship-detection.py --bbox 121.0 30.0 122.0 31.0 --synthetic --cfar os --output-dir ./out

Example 3 (real SAR imagery)

python geoskill-sar-ship-detection.py --input sar_scene.tif --cfar ca --pfa 1e-5 --output-dir ./out

Example 4 (tuning window parameters)

python geoskill-sar-ship-detection.py --input sar_scene.tif --guard 3 --background 8 --output-dir ./out

Output / 输出

FileFormatDescription
ships.geojsonGeoJSONShip point targets (centroids) + attributes
detection_mask.tifGeoTIFFDetection mask (0/1)
ship_attributes.jsonJSONTarget attribute table (area/peak/bounding box)
detection_count.jsonJSONDetection count and parameters
output-manifest.jsonJSONRun manifest

Data Source / 数据源 / Source

Local single-band SAR intensity GeoTIFF, or a --synthetic simulated sea surface (exponential clutter + bright ship targets).

Privacy / 隐私声明 / Privacy

  • Runs offline by default; --synthetic mode is fully network-free.
  • All processing is done locally; no user data is uploaded.

License / License

MIT



name: geoskill-sar-ship-detection description: 'SAR 船舶检测:CA/OS-CFAR 恒虚警检测 + 连通域聚类,从单极化 SAR 强度影像提取船舶目标并输出 GeoJSON 矢量与属性表'

SAR船舶检测 | SAR Ship Detection

从单极化 SAR 强度影像中自动检测海上船舶目标。核心流程:

  1. CFAR 恒虚警检测:在滑动窗口内用保护带外的背景单元估计局部杂波功率, 自适应设定门限,在不同海况下保持恒定虚警率。
    • CA-CFAR(单元平均):门限 = α·μ_bg,α = N·(Pfa^(−1/N) − 1)(指数杂波解析解)。
    • OS-CFAR(有序统计):取背景第 k 次序统计量估计杂波,对多目标/杂波边缘更稳健。
  2. 连通域聚类:对超门限像元做连通域标记,提取每个目标的面积、质心、 峰值强度与外接框,转成地理坐标输出 GeoJSON。

应用场景

  • 海上船舶监视、非法捕捞监测
  • 港口与航道交通流统计
  • 海上搜救目标筛查

依赖

pip install 'numpy' 'rasterio' 'geopandas' 'shapely' 'scipy'

使用方法

示例 1(合成数据,离线)

python geoskill-sar-ship-detection.py --bbox 121.0 30.0 122.0 31.0 --synthetic --cfar ca --pfa 1e-4 --output-dir ./out

示例 2(OS-CFAR)

python geoskill-sar-ship-detection.py --bbox 121.0 30.0 122.0 31.0 --synthetic --cfar os --output-dir ./out

示例 3(真实 SAR 影像)

python geoskill-sar-ship-detection.py --input sar_scene.tif --cfar ca --pfa 1e-5 --output-dir ./out

示例 4(调窗口参数)

python geoskill-sar-ship-detection.py --input sar_scene.tif --guard 3 --background 8 --output-dir ./out

输出

文件格式说明
ships.geojsonGeoJSON船舶点目标(质心)+ 属性
detection_mask.tifGeoTIFF检测掩膜(0/1)
ship_attributes.jsonJSON目标属性表(面积/峰值/外接框)
detection_count.jsonJSON检测计数与参数
output-manifest.jsonJSON运行清单

数据源 / Source

本地单波段 SAR 强度 GeoTIFF,或 --synthetic 模拟海面(指数杂波 + 高亮船舶)。

隐私声明 / Privacy

  • 默认离线运行,--synthetic 模式完全无网络。
  • 所有处理在本地完成,不上传用户数据。

License

MIT

相关技能

基于 SAR 低后向散射特性的洪水范围制图:Otsu 阈值分割低 σ⁰ 水体 + 形态学去噪 + 可选 DEM 坡度排除,并矢量化为 GeoJSON。SAR flood extent mapping via Otsu thresholding of low backscatter, morphological cleanup and vectorization. 输出洪水二值 GeoTIFF + 面积统计 JSON + 范围 GeoJSON。

1 次安装

SAR 暗斑油膜检测 — 从 SAR 暗斑中筛选疑似油膜,结合风场、形状、纹理、船舶和自然 slick 线索 输出人工复核候选。支持后向散射阈值分割、多特征融合置信度评分与误报过滤。

1 次安装

融合InSAR形变速率、后向散射变化与DEM坡度综合加权评分,双门限提取疑似滑坡连通域并矢量化分级(high/medium/low),输出滑坡GeoJSON、形变速率/风险评分GeoTIFF与风险汇总JSON。SAR landslide detection fusing InSAR deformation, backscatter change and slope.

1 次安装

SAR 海面风场反演:基于简化 CMOD5/CMOD7 经验地球物理模型,由后向散射系数 σ⁰ 与风向二分法数值反演海面风速场

1 次安装

对 SAR 影像执行 Lee/Frost/多视 斑点噪声滤波,抑制相干斑噪声并保持边缘。Lee/Frost/multilook speckle filtering for SAR imagery. 输入单波段或多波段 SAR 强度 GeoTIFF(或用 --synthetic 生成含乘性斑斑噪声的场景),输出滤波后 GeoTIFF + 参数 JSON。

1 次安装

极化SAR分解:Cloude-Pottier H/A/α 特征分解与 Freeman 三分量分解,输出散射熵、各向异性、散射角与表面/二面角/体散射功率

1 次安装