增加模块;增加主调用命令
This commit is contained in:
463
AUTOMATED_TESTS.md
Normal file
463
AUTOMATED_TESTS.md
Normal file
@ -0,0 +1,463 @@
|
||||
# 高光谱分析工具包自动测试文档
|
||||
|
||||
本文档包含了高光谱分析工具包所有功能的自动化测试命令。这些测试命令可以用来验证各个模块的功能是否正常工作。
|
||||
|
||||
## 测试环境要求
|
||||
|
||||
- Python 3.7+
|
||||
- 已安装所有依赖包(见 requirements.txt)
|
||||
- 测试数据文件存在于指定路径
|
||||
|
||||
## 测试命令列表
|
||||
|
||||
### 1. 降维分析 (dim-reduction)
|
||||
```bash
|
||||
# PCA降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method pca --n-components 3 --output-file E:\code\spectronon\20251226\output\pca.dat
|
||||
|
||||
# ICA降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method ica --n-components 5 --output-file E:\code\spectronon\20251226\output\ica.dat
|
||||
|
||||
# FA因子分析降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method fa --n-components 4 --output-file E:\code\spectronon\20251226\output\fa.dat
|
||||
|
||||
# LDA线性判别分析降维测试
|
||||
#python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method lda --n-components 2 --output-file E:\code\spectronon\20251226\output\lda.dat
|
||||
|
||||
# MDS多维标度法降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method mds --n-components 3 --output-file E:\code\spectronon\20251226\output\mds.dat
|
||||
|
||||
# Isomap等距映射降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method isomap --n-components 3 --output-file E:\code\spectronon\20251226\output\isomap.dat
|
||||
|
||||
# LLE局部线性嵌入降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method lle --n-components 2 --output-file E:\code\spectronon\20251226\output\lte.dat
|
||||
|
||||
# t-SNE降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method t-sne --n-components 2 --output-file E:\code\spectronon\20251226\output\tsne.dat
|
||||
|
||||
# 批量降维测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --batch-methods pca ica fa lda --batch-components 3 4 3 2 --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 2. 图像分割 (segmentation)
|
||||
```bash
|
||||
# 固定阈值分割测试
|
||||
#python main.py segmentation --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method fixed --band-index 50 --threshold 128 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
|
||||
# 迭代法分割测试
|
||||
python main.py segmentation --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method iterative --band-index 30 --max-iterations 100 --convergence-threshold 0.01 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Otsu分割测试
|
||||
python main.py segmentation --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method otsu --band-index 50 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# ISODATA分割测试
|
||||
python main.py segmentation --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method isodata --band-index 40 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 自适应分割测试
|
||||
python main.py segmentation --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method adaptive --band-index 25 --adaptive-block-size 15 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 批量分割测试
|
||||
#python main.py segmentation --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --batch-methods fixed otsu adaptive isodata --batch-bands 20 30 40 50 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
```
|
||||
|
||||
### 3. 边缘检测 (edge-detection)
|
||||
```bash
|
||||
## Sobel边缘检测测试
|
||||
#python main.py edge-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method sobel --edge-band-index 25 --sobel-dx 1 --sobel-dy 0 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Scharr边缘检测测试
|
||||
python main.py edge-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method scharr --edge-band-index 25 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Laplacian边缘检测测试
|
||||
python main.py edge-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method laplacian --edge-band-index 25 --laplacian-ksize 1 --laplacian-scale 1.0 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# LoG边缘检测测试
|
||||
python main.py edge-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method log --edge-band-index 25 --log-sigma 1.0 --log-threshold 0.0 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Canny边缘检测测试
|
||||
python main.py edge-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method canny --edge-band-index 25 --canny-min-threshold 50 --canny-max-threshold 150 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 批量边缘检测测试
|
||||
python main.py edge-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --batch --batch-bands 10 25 50 --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 4. 异常检测 (anomaly-detection)
|
||||
```bash
|
||||
# 协方差异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method covariance --contamination 0.1 --output-file "E:\code\spectronon\20251226\output\covariance.dat"
|
||||
|
||||
# One-Class SVM RBF核异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method one-class-svm --ocsvm-kernel rbf --ocsvm-nu 0.1 --output-file "E:\code\spectronon\20251226\output\svm_rbf.dat"
|
||||
|
||||
# One-Class SVM多项式核异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method one-class-svm --ocsvm-kernel poly --ocsvm-degree 3 --ocsvm-use-grid-search --output-file "E:\code\spectronon\20251226\output\svmano_poly.dat"
|
||||
|
||||
# RX全局背景异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method rx --background-model global --contamination 0.1 --output-file "E:\code\spectronon\20251226\output\rx_global.dat"
|
||||
|
||||
# RX局部窗口异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method rx --background-model local_square --window-size 7 --contamination 0.1 --output-file "E:\code\spectronon\20251226\output\rx_local.dat"
|
||||
|
||||
# Squared Loss Probability异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method squared-loss-probability --contamination 0.1 --output-file "E:\code\spectronon\20251226\output\slp.dat"
|
||||
|
||||
# Squared Loss with PCA异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method squared-loss-probability --reconstruction-method pca --slp-n-components 10 --output-file "E:\code\spectronon\20251226\output\slp_pca.dat"
|
||||
|
||||
# Squared Loss with Linear重构异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method squared-loss-probability --reconstruction-method linear --target-band 50 --probability-mode --output-file "E:\code\spectronon\20251226\output\slp_linear.dat"
|
||||
```
|
||||
|
||||
### 5. 分类分析 (classification)
|
||||
```bash
|
||||
# SVM RBF核分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method svm --svm-kernel rbf --output-file E:\code\spectronon\20251226\output\svm_rbf.dat
|
||||
|
||||
# SVM线性核分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method svm --svm-kernel linear --output-file E:\code\spectronon\20251226\output\svm_linear.dat
|
||||
|
||||
# 随机森林分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method random_forest --rf-n-estimators 100 --rf-max-depth 10 --output-file E:\code\spectronon\20251226\output\rf.dat
|
||||
|
||||
# KNN分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method knn --knn-n-neighbors 5 --output-file E:\code\spectronon\20251226\output\knn.dat
|
||||
|
||||
# 逻辑回归分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method logistic_regression --lr-c 1.0 --output-file E:\code\spectronon\20251226\output\lr.dat
|
||||
|
||||
# 线性判别分析分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method linear_discriminant --output-file E:\code\spectronon\20251226\output\lda.dat
|
||||
|
||||
# 二次判别分析分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method quadratic_discriminant --output-file E:\code\spectronon\20251226\output\qda.dat
|
||||
|
||||
# PLS-DA分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method plsda --pls-n-components 10 --output-file E:\code\spectronon\20251226\output\plsda.dat
|
||||
|
||||
# XGBoost分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method xgboost --xgb-n-estimators 100 --xgb-max-depth 6 --output-file E:\code\spectronon\20251226\output\xgb.dat
|
||||
|
||||
# LightGBM分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method lightgbm --lgb-n-estimators 100 --lgb-learning-rate 0.1 --output-file E:\code\spectronon\20251226\output\lgb.dat
|
||||
|
||||
# CatBoost分类测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method catboost --cb-n-estimators 100 --cb-depth 6 --output-file E:\code\spectronon\20251226\output\cb.dat
|
||||
```
|
||||
|
||||
### 6. 聚类分析 (clustering)
|
||||
```bash
|
||||
# K-means聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method kmeans --n-clusters 5 --use-scaling --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 模糊C均值聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method fuzzy-cmeans --n-clusters 4 --fcm-m 2.0 --fcm-error 0.005 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# GMM高斯混合模型聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method gmm --n-clusters 4 --gmm-covariance-type full --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 层次聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method hierarchical --n-clusters 3 --hier-linkage ward --hier-affinity euclidean --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# DBSCAN密度聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method dbscan --dbscan-eps 0.5 --dbscan-min-samples 5 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 谱聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method spectral --n-clusters 3 --spectral-affinity rbf --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 子空间聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method subspace --n-clusters 4 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 集成聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method ensemble --n-clusters 3 --ensemble-voting hard --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 批量聚类测试
|
||||
python main.py clustering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --batch --n-clusters 4 --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 7. 监督分类 (supervised-classification)
|
||||
```bash
|
||||
# 监督分类测试(所有方法)
|
||||
python main.py supervised-classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method all --xml_file "E:\code\spectronon\20251226\data\roi.xml" --visualize --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 欧氏距离监督分类测试
|
||||
python main.py supervised-classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method euclidean --xml_file "E:\code\spectronon\20251226\data\roi.xml" --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 余弦距离监督分类测试
|
||||
python main.py supervised-classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method cosine --xml_file "E:\code\spectronon\20251226\data\roi.xml" --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 8. 特征选择 (feature-selection)
|
||||
```bash
|
||||
# SPA特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method Spa --label-column label --n-features 15 --spectral-columns "1:114" --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# CARS特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method Cars --label-column label --n-features 20 --cars-n 30 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# UVE特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method Uve --label-column label --n-features 25 --uve-ncomp 15 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# GA遗传算法特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method GA --label-column label --n-features 10 --ga-population-size 20 --ga-n-generations 30 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Relief-F特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method ReliefF --label-column label --n-features 15 --relief-k 10 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# SiPLS特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method SiPLS --label-column label --n-features 20 --sipls-interval-width 10 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# LARS特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method Lars --label-column label --n-features 15 --lar-cv 5 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Random Frog特征选择测试
|
||||
python main.py feature-selection --input "E:\code\spectronon\20251226\data\class.csv" --method RandomFrog --label-column label --n-features 18 --random-frog-n-frogs 50 --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 9. 光谱指数 (spectral-index)
|
||||
```bash
|
||||
# 批量光谱指数计算测试
|
||||
python main.py spectral-index --input "E:\code\spectronon\20251226\data\class.csv" --batch --output-dir E:\code\spectronon\20251226\output --data-format csv --label-column Label --spectral-start 1 --spectral-end 114 --index-csv "E:\code\spectronon\20251226\data\spectral_index.csv" --formula-csv E:\code\spectronon\20251226\data\famula.csv
|
||||
|
||||
|
||||
```
|
||||
|
||||
### 10. 数据预处理 (preprocessing)
|
||||
```bash
|
||||
# Min-Max标准化预处理测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method MMS --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 标准化预处理测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method SS --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 中心化预处理测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method CT --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# SNV预处理测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method SNV --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 移动平均平滑测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method MA --spectral-start-index 1 --ma-window 5 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Savitzky-Golay平滑测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method SG --spectral-start-index 1 --sg-window 15 --sg-poly 2 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 一阶导数测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method D1 --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 二阶导数测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method D2 --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 导数测试(DT)
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method DT --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 多重散射校正测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method MSC --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 小波变换测试
|
||||
python main.py preprocessing --input "E:\code\spectronon\20251226\data\class.csv" --method wave --spectral-start-index 1 --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 11. 形状特征 (shape-features)
|
||||
```bash
|
||||
# 形状特征提取测试
|
||||
python main.py shape-features --input "E:\code\spectronon\20251226\output\result.dat" --hdr-file "E:\code\spectronon\20251226\output\result.hdr" --input-type dat --shape-band-index 0 --min-area 50 --output-dir E:\code\spectronon\20251226\output --save-labeled-image
|
||||
|
||||
# 形状特征提取(分水岭分割)测试
|
||||
python main.py shape-features --input "E:\code\spectronon\20251226\output\result.dat" --hdr-file "E:\code\spectronon\20251226\output\result.hdr" --input-type dat --shape-band-index 0 --use-watershed --watershed-min-distance 15 --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 12. GLCM纹理特征 (glcm)
|
||||
```bash
|
||||
# GLCM纹理特征提取测试
|
||||
python main.py glcm --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --band-index 25 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# GLCM多角度纹理特征测试
|
||||
python main.py glcm --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --band-index 25 --step 1 2 4 --angle 0 45 90 135 --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 13. 颜色分析 (color-analysis)
|
||||
```bash
|
||||
# CIEDE2000色差分析测试
|
||||
python main.py color-analysis --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method CIEDE2000 --standards-file "E:\code\spectronon\20251226\data\clolor.csv" --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# CIE94色差分析测试
|
||||
python main.py color-analysis --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method CIE94 --standards-file "E:\code\spectronon\20251226\data\clolor.csv" --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 14. 图像滤波 (filtering)
|
||||
```bash
|
||||
# 均值滤波测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type mean --filter-band-index 25 --kernel-size 3 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 中值滤波测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type median --filter-band-index 25 --kernel-size 3 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 高斯滤波测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type gaussian --filter-band-index 25 --kernel-size 5 --sigma 1.5 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 双边滤波测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type bilateral --filter-band-index 25 --kernel-size 5 --sigma-color 50 --sigma-space 50 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 形态学开运算测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type opening --filter-band-index 25 --kernel-size 3 --se-shape disk --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 形态学闭运算测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type closing --filter-band-index 25 --kernel-size 3 --se-shape disk --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 形态学腐蚀测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type erosion --filter-band-index 25 --kernel-size 3 --se-shape square --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 形态学膨胀测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type dilation --filter-band-index 25 --kernel-size 3 --se-shape square --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 形态学梯度测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type gradient --filter-band-index 25 --kernel-size 3 --se-shape disk --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 顶帽变换测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type tophat --filter-band-index 25 --kernel-size 5 --se-shape disk --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 黑帽变换测试
|
||||
python main.py filtering --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --filter-type blackhat --filter-band-index 25 --kernel-size 5 --se-shape disk --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 15. 回归分析 (regression)
|
||||
```bash
|
||||
# 线性回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models linear --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Ridge回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models ridge --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Lasso回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models lasso --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# Elastic Net回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models elastic_net --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# SVR回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models svr --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 随机森林回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models random_forest --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# XGBoost回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models xgboost --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# LightGBM回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models lightgbm --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# CatBoost回归测试
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models catboost --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 多模型对比测试(带超参数调优)
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models ridge lasso xgboost lightgbm --tune-params --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 多模型对比测试(默认参数)
|
||||
python main.py regression --input "E:\code\spectronon\20251226\data\data.csv" --label-column Label --models ridge lasso svr random_forest --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 16. 回归预测 (regression-prediction)
|
||||
```bash
|
||||
# 回归预测测试
|
||||
python main.py regression-prediction --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --model-path "E:\code\spectronon\20251226\models\ridge_20260106_104115.pkl" --mask-path "E:\code\spectronon\20251226\data\roi.shp" --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
# 回归预测测试(批量模型)
|
||||
python main.py regression-prediction --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --model-path "E:\code\spectronon\20251226\models" --batch-mode --output-dir E:\code\spectronon\20251226\output
|
||||
```
|
||||
|
||||
### 17. 色差计算 (delta-e)
|
||||
```bash
|
||||
# 图像模式色差计算测试
|
||||
python main.py delta-e --mode image --input "E:\code\spectronon\20251226\data\LAB.hdr" --method CIE76 --create-histogram --standards "E:\code\spectronon\20251226\data\clolor.csv" --output-file E:\code\spectronon\20251226\output\delate.bil --create-heatmap
|
||||
# 图像模式色差计算(带热图)测试
|
||||
python main.py delta-e --mode image --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method CIE76 --create-histogram --standards "E:\code\spectronon\20251226\data\clolor.csv" --output-file E:\code\spectronon\20251226\output\delate.bil --create-heatmap
|
||||
|
||||
# 两两比较模式色差计算测试
|
||||
python main.py delta-e --mode pairwise --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method CIEDE2000 --reference-range 0,1 --target-range 2,3 --output-file E:\code\spectronon\20251226\output\pairwise_deltae.bil
|
||||
```
|
||||
|
||||
### 18. 光谱到颜色转换 (spectral-to-color)
|
||||
```bash
|
||||
# Lab颜色空间转换测试
|
||||
python main.py spectral-to-color --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --color_space Lab --illuminant D50 --observer 2° --output E:\code\spectronon\20251226\output\LAB.dat
|
||||
|
||||
# XYZ颜色空间转换测试
|
||||
python main.py spectral-to-color --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --color_space XYZ --illuminant D65 --observer 10° --output E:\code\spectronon\20251226\output\XYZ.dat
|
||||
|
||||
# LCH颜色空间转换测试
|
||||
python main.py spectral-to-color --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --color_space LCH --illuminant A --observer 2° --output E:\code\spectronon\20251226\output\LCH.dat
|
||||
```
|
||||
|
||||
### 19. XYZ到RGB转换 (xyz-to-rgb)
|
||||
```bash
|
||||
# XYZ到RGB转换测试
|
||||
python main.py xyz-to-rgb --input "E:\code\spectronon\20251226\output\XYZ.hdr" --output "E:\code\spectronon\20251226\output\RGB_sRGB.tif" --rgb-space "sRGB" --gamma "sRGB"
|
||||
|
||||
# Adobe RGB颜色空间转换测试
|
||||
python main.py xyz-to-rgb --input "E:\code\spectronon\20251226\output\XYZ.hdr" --output "E:\code\spectronon\20251226\output\RGB_Adobe.tif" --rgb-space "Adobe RGB (1998)" --gamma "sRGB"
|
||||
|
||||
# 高精度输出测试
|
||||
python main.py xyz-to-rgb --input "E:\code\spectronon\20251226\output\XYZ.hdr" --output "E:\code\spectronon\20251226\output\RGB_16bit.tif" --rgb-space "sRGB" --gamma "sRGB" --output-dtype "uint16"
|
||||
```
|
||||
|
||||
### 20. PROSAIL模拟器GUI (prosail-gui)
|
||||
```bash
|
||||
# PROSAIL GUI启动测试
|
||||
python main.py prosail-gui
|
||||
|
||||
# PROSAIL命令行模式测试
|
||||
python main.py prosail-gui --no-gui --save-default
|
||||
```
|
||||
|
||||
## 批量测试脚本
|
||||
|
||||
创建 `run_all_tests.bat` 文件来批量运行所有测试:
|
||||
|
||||
```batch
|
||||
@echo off
|
||||
echo 开始运行高光谱分析工具包自动化测试...
|
||||
|
||||
echo.
|
||||
echo 1. 降维分析测试
|
||||
python main.py dim-reduction --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method pca --n-components 3 --output-file E:\code\spectronon\20251226\output\pca.dat
|
||||
|
||||
echo.
|
||||
echo 2. 图像分割测试
|
||||
python main.py segmentation --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method otsu --band-index 50 --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
echo.
|
||||
echo 3. 异常检测测试
|
||||
python main.py anomaly-detection --input "E:\code\spectronon\20251226\data\leaf_small.bip.hdr" --method rx --contamination 0.1 --output-file "E:\code\spectronon\20251226\output\RX.dat"
|
||||
|
||||
echo.
|
||||
echo 4. 分类分析测试
|
||||
python main.py classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip" --roi-file "E:\code\spectronon\20251226\data\roi.xml" --method svm --output-file E:\code\spectronon\20251226\output\svm.dat
|
||||
|
||||
echo.
|
||||
echo 5. 监督分类测试
|
||||
python main.py supervised-classification --input "E:\code\spectronon\20251226\data\GreenPaintChipsSmall.bip.hdr" --method all --xml_file "E:\code\spectronon\20251226\data\roi.xml" --visualize --output-dir E:\code\spectronon\20251226\output
|
||||
|
||||
echo.
|
||||
echo 所有测试完成!
|
||||
pause
|
||||
```
|
||||
|
||||
## 注意事项
|
||||
|
||||
1. **路径修改**:根据你的实际环境修改输入文件路径和输出目录路径
|
||||
2. **依赖数据**:确保所有引用的数据文件(如 `.hdr`、`.xml`、`.csv` 等)存在
|
||||
3. **输出目录**:确保输出目录存在且有写权限
|
||||
4. **内存使用**:某些大型图像处理可能需要较多内存
|
||||
5. **执行时间**:一些复杂的算法(如 t-SNE、遗传算法等)可能需要较长时间
|
||||
|
||||
## 预期输出
|
||||
|
||||
每个测试命令都会在指定的输出目录生成相应的结果文件,包括:
|
||||
- 数据文件(`.dat`、`.hdr`、`.csv` 等)
|
||||
- 可视化图表(`.png`、`.jpg` 等)
|
||||
- 统计报告和日志文件
|
||||
|
||||
成功执行的标志是命令返回代码为 0,且在输出目录中生成了预期的文件。
|
||||
Reference in New Issue
Block a user