Install
openclaw skills install @ruiduobao/geoskill-hyperspectral-classificationopenclaw skills install @ruiduobao/geoskill-hyperspectral-classificationPerforms per-pixel supervised classification on hyperspectral image cubes (bands × H × W, typically 30+ bands). PCA first projects the high-dimensional spectra into principal-component space to reduce noise and redundancy; a classifier is then trained with random forest (RF) or support vector machine (SVM) to predict the land-cover class of each pixel.
Synthetic mode automatically generates N land-cover classes with characteristic spectral signatures (e.g., minerals/vegetation/soil/water), distributed as spatial patches with added noise; training samples are produced by stratified sampling from the ground-truth labels (70% training / 30% validation by default). The outputs include a classification map, accuracy assessment (overall accuracy, Kappa), and a confusion matrix. Suitable for hyperspectral mapping, mineral/vegetation mapping, and method-comparison teaching.
pip install numpy rasterio scipy scikit-learn
python geoskill-hyperspectral-classification.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-hyperspectral-classification.py \
--bbox 116.0 39.0 117.0 40.0 \
--synthetic --n-bands 30 --n-classes 4 --method rf \
--output-dir ./rf_4class
python geoskill-hyperspectral-classification.py \
--bbox 121.0 31.0 122.0 32.0 \
--synthetic --n-bands 30 --n-classes 4 --method svm \
--output-dir ./svm_4class
python geoskill-hyperspectral-classification.py \
--bbox 116.0 39.0 117.0 40.0 \
--synthetic --n-bands 60 --n-classes 6 --method rf \
--output-dir ./rf_6class
python geoskill-hyperspectral-classification.py \
--input cuprite_subset.tif --method rf \
--output-dir ./real_rf
| File | Format | Description |
|---|---|---|
classification.tif | GeoTIFF (int class ID) | Per-pixel classification result, EPSG:4326 |
accuracy.json | JSON | Overall accuracy, Kappa, confusion matrix, per-class accuracy |
output-manifest.json | JSON | Run manifest (input/output/QA/software versions) |
--synthetic mode reads no external dataMIT
对高光谱影像立方体(bands × H × W,波段数通常 30+)执行逐像元监督 分类。先用 PCA 把高维光谱投影到主成分空间降噪去冗余,再用随机森林 (RF)或支持向量机(SVM)训练分类器,对每个像元预测地物类别。
合成模式自动生成 N 类具有特征光谱曲线的地物(如矿物/植被/土壤/水体), 按空间斑块分布并叠加噪声;训练样本由真值标签分层抽样产生(默认 70% 训练 / 30% 验证),输出分类图、精度评估(总体精度、Kappa)与混淆 矩阵。适用于高光谱制图、矿物/植被填图、方法对比教学等场景。
pip install numpy rasterio scipy scikit-learn
python geoskill-hyperspectral-classification.py --bbox 116.0 39.0 117.0 40.0 --synthetic --output-dir ./out
python geoskill-hyperspectral-classification.py \
--bbox 116.0 39.0 117.0 40.0 \
--synthetic --n-bands 30 --n-classes 4 --method rf \
--output-dir ./rf_4class
python geoskill-hyperspectral-classification.py \
--bbox 121.0 31.0 122.0 32.0 \
--synthetic --n-bands 30 --n-classes 4 --method svm \
--output-dir ./svm_4class
python geoskill-hyperspectral-classification.py \
--bbox 116.0 39.0 117.0 40.0 \
--synthetic --n-bands 60 --n-classes 6 --method rf \
--output-dir ./rf_6class
python geoskill-hyperspectral-classification.py \
--input cuprite_subset.tif --method rf \
--output-dir ./real_rf
| 文件 | 格式 | 说明 |
|---|---|---|
classification.tif | GeoTIFF (int 类别号) | 逐像元分类结果,EPSG:4326 |
accuracy.json | JSON | 总体精度、Kappa、混淆矩阵、各类精度 |
output-manifest.json | JSON | 运行清单(输入/输出/QA/软件版本) |
--synthetic 模式不读取任何外部数据MIT