LSTM 时序预测网络(torch+CUDA,默认) + 经典线性/多项式/AR(p) 解释基线:多步外推 + 留出 MAE/RMSE 验证 + 逐像元栅格输出
Data & analysis
geoskill-ai-training-data-annotation
Try it小型 U-Net 二值语义分割 (torch+CUDA) 预标注 + 主动学习不确定性选样,输出 COCO/GeoJSON 标注与不确定性栅格
What it does
小型 U-Net 二值语义分割 (torch+CUDA) 预标注 + 主动学习不确定性选样,输出 COCO/GeoJSON 标注与不确定性栅格
The skill document
AI训练数据标注 | AI Training Data Annotation
Automatically generates pre-annotations (pseudo-labels) for remote sensing imagery and uses active learning to select the most uncertain samples for manual review, outputting both standard COCO JSON and GeoJSON annotation formats plus an uncertainty raster.
Core model: a small U-Net (unet-lite, base=8, 3-level encoder-decoder with skip connections) performing target vs background binary semantic segmentation by default on torch + CUDA. The model infers on single-band imagery to produce an (H, W, 2) softmax probability map; the target probability is Otsu-thresholded and connected components are extracted with 8-neighborhood connectivity to generate bbox pre-annotations. Uncertainty is computed as the Shannon entropy of the probability map; the Top-k samples by regional mean entropy are selected for manual review. Pretrained weights anno_unet_weights.pt are shipped with the skill (automatically trained on GPU and persisted at first run when missing). The --method otsu classical threshold baseline is also retained for comparison and GPU-free environments.
Dependencies / 依赖
pip install numpy rasterio scipy torch --index-url https://download.pytorch.org/whl/cu121
The classical baseline (--method otsu) does not require torch.
Usage / 使用方法
Example 1 (Synthetic Data, Offline)
python geoskill-ai-training-data-annotation.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
Example 2: Automatic Annotation of Synthetic Data (Offline)
python geoskill-ai-training-data-annotation.py --bbox 116.0 39.0 117.0 40.0 --synthetic --n-review 2 --output-dir ./out
Example 3: Real-Image Pre-Annotation
python geoskill-ai-training-data-annotation.py --input scene.tif --threshold 60 --min-area 9 --format both --output-dir ./out
示例 4:仅导出 COCO
python geoskill-ai-training-data-annotation.py --bbox 121.0 31.0 122.0 32.0 --synthetic --format coco --output-dir ./out
Output / 输出
| File | Format | Description |
|---|---|---|
annotations_coco.json | JSON | Standard COCO annotations (images/annotations/categories) |
annotations.geojson | GeoJSON | Georeferenced pre-annotation boxes + confidence/uncertainty/review flags |
uncertainty.tif | GeoTIFF | Per-pixel entropy (uncertainty) raster |
output-manifest.json | JSON | Run manifest (inputs/outputs/QA/exit code) |
Data Source / 数据源 / Source
Local GeoTIFF, or --synthetic (probability map with high entropy at boundaries; target ground truth known).
Privacy / 隐私声明 / Privacy
- Runs offline by default;
--syntheticmode requires no network at all. - All processing is done locally; no user data is ever uploaded.
License / License
MIT
name: geoskill-ai-training-data-annotation description: '小型 U-Net 二值语义分割 (torch+CUDA) 预标注 + 主动学习不确定性选样,输出 COCO/GeoJSON 标注与不确定性栅格'
AI训练数据标注 | AI Training Data Annotation
为遥感影像自动生成预标注(伪标签),并用主动学习挑出最不确定的样本送人工复核,输出标准 COCO JSON 与 GeoJSON 两种标注格式及不确定性栅格。
核心模型:小型 U-Net (unet-lite,base=8,3 级编解码 + skip),默认在 torch + CUDA 上做 target vs background 二值语义分割。模型对单波段影像推理得到 (H, W, 2) softmax 概率图,对 target 概率做 Otsu 阈值化 + 8 邻域连通域,生成 bbox 预标注;不确定性 = 概率图香农熵,按区域平均熵 Top-k 选样送人工复核。随附预训练权重 anno_unet_weights.pt(缺失时在首次运行时 GPU 自动训练并落盘)。同时保留 --method otsu 经典阈值基线用于对比与无 GPU 环境。
依赖
pip install numpy rasterio scipy torch --index-url https://download.pytorch.org/whl/cu121
如要跑经典基线(--method otsu)无需 torch。
使用方法
示例 1(合成数据,离线)
python geoskill-ai-training-data-annotation.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
示例 2:合成数据自动标注(离线)
python geoskill-ai-training-data-annotation.py --bbox 116.0 39.0 117.0 40.0 --synthetic --n-review 2 --output-dir ./out
示例 3:真实影像预标注
python geoskill-ai-training-data-annotation.py --input scene.tif --threshold 60 --min-area 9 --format both --output-dir ./out
示例 4:仅导出 COCO
python geoskill-ai-training-data-annotation.py --bbox 121.0 31.0 122.0 32.0 --synthetic --format coco --output-dir ./out
输出
| 文件 | 格式 | 说明 |
|---|---|---|
annotations_coco.json | JSON | 标准 COCO 标注(images/annotations/categories) |
annotations.geojson | GeoJSON | 地理坐标预标注框 + 置信度/不确定性/复核标记 |
uncertainty.tif | GeoTIFF | 逐像元熵(不确定性)栅格 |
output-manifest.json | JSON | 运行清单(输入/输出/QA/退出码) |
数据源 / Source
本地 GeoTIFF,或 --synthetic(影像 + 边界高熵的概率图,目标真值已知)。
隐私声明 / Privacy
- 默认离线运行,
--synthetic模式完全无网络。 - 所有处理在本地完成,不上传任何用户数据。
License
MIT
Related skills
基于 SRCNN(Dong 2014)卷积神经网络的 2x/3x/4x 影像超分辨率,在 CUDA GPU 上训练与推理,输出高分辨率栅格与 PSNR/SSIM 评估
Siamese 全卷积网络(FC-Siam-diff 风格)双时相变化检测:GPU 训练/推理,输出变化概率、二值变化图与变化图斑
Detect informal settlements by fusing texture irregularity, building morphology and spectral mixing into a classification score.
Analyze urban heat island intensity and ventilation index from land surface temperature, NDVI, impervious surface and building morphology.
用最近邻 / 双线性 / 三次卷积改变栅格分辨率,输出重采样后的 GeoTIFF 与统计。Resample raster resolution with nearest / bilinear / cubic convolution and emit a GeoTIFF plus statistics.