界面优化

This commit is contained in:
DXC
2026-05-07 14:23:58 +08:00
parent dc33ee260d
commit c12b9d8d8a
24 changed files with 6090 additions and 4638 deletions

View File

@ -555,7 +555,13 @@ class WaterQualityInference:
print(f"输入数据形状: {spectra_processed.shape}")
try:
predictions = model.predict(spectra_processed)
# 清洗 NaN / Inf防止 SVR 等模型报错
spectra_clean = np.nan_to_num(spectra_processed, nan=0.0, posinf=0.0, neginf=0.0)
if np.any(np.isnan(spectra_clean)) or np.any(np.isinf(spectra_clean)):
print("警告: 清洗后数据中仍存在 NaN/Inf已重置为 0")
spectra_clean = np.nan_to_num(spectra_clean, nan=0.0, posinf=0.0, neginf=0.0)
predictions = model.predict(spectra_clean)
print(f"预测完成,结果形状: {predictions.shape}")
print(f"预测值范围: [{np.min(predictions):.4f}, {np.max(predictions):.4f}]")
print(f"预测值统计: 均值={np.mean(predictions):.4f}, 标准差={np.std(predictions):.4f}")

View File

@ -1724,7 +1724,11 @@ class WaterQualityInversionPipeline:
final_water_mask, temp_shape, geotransform, projection, img_path
)
# 应用Goodman算法直接传递文件路径让算法类使用GDAL逐波段处理
# 加载影像数据(Goodman算法需要numpy数组用于后插值
image_array, geotransform, projection = self._load_image_as_array(img_path)
print(f"影像尺寸: {image_array.shape}")
# 应用Goodman算法传递文件路径
goodman = Goodman(img_path, NIR_lower=nir_lower, NIR_upper=nir_upper,
A=goodman_A, B=goodman_B, water_mask=mask_for_algorithm,
output_path=output_path) # 传递output_path算法类会保存